emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sweeprolog 21f7897e42 2/3: TEST: add unit test for nested


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 21f7897e42 2/3: TEST: add unit test for nested Elisp->Prolog->Elisp call chains
Date: Thu, 6 Oct 2022 15:59:11 -0400 (EDT)

branch: elpa/sweeprolog
commit 21f7897e420d096d6a32e0942035ea0677509690
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    TEST: add unit test for nested Elisp->Prolog->Elisp call chains
---
 sweeprolog-tests.el | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el
index bb51661d69..a294c5f601 100644
--- a/sweeprolog-tests.el
+++ b/sweeprolog-tests.el
@@ -2,6 +2,29 @@
 
 (require 'sweeprolog)
 
+(defconst sweeprolog-tests-greeting
+  "Hello from Elisp from Prolog from Elisp from Prolog from Elisp!")
+
+(defun sweeprolog-tests-greet ()
+  (sweeprolog-open-query "user" "user"
+                         "sweep_funcall"
+                         "sweeprolog-tests-greet-1")
+  (let ((sol (sweeprolog-next-solution)))
+    (sweeprolog-cut-query)
+    (cdr sol)))
+
+(defun sweeprolog-tests-greet-1 ()
+  (message sweeprolog-tests-greeting))
+
+(ert-deftest elisp->prolog->elisp->prolog->elisp ()
+  "Tests calling Elisp from Prolog from Elisp from Prolog from Elisp."
+  (should (equal (sweeprolog-open-query "user" "user"
+                                        "sweep_funcall"
+                                        "sweeprolog-tests-greet")
+                 t))
+  (should (equal (sweeprolog-next-solution) (cons '! 
sweeprolog-tests-greeting)))
+  (should (equal (sweeprolog-cut-query) t)))
+
 (ert-deftest lists:member/2 ()
   "Tests calling the Prolog predicate permutation/2 from Elisp."
   (should (equal (sweeprolog-open-query "user" "lists" "member" (list 1 2 3) 
t) t))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]