git » jacl.git » commit 13450b4

DO, DO*, DOLIST tests

author Alan Dipert
2021-08-04 23:47:10 UTC
committer Alan Dipert
2021-08-04 23:47:10 UTC
parent f9abcbc308d35bbc43436a37110ed6494a92af4b

DO, DO*, DOLIST tests

jacl-tests.lisp +18 -3

diff --git a/jacl-tests.lisp b/jacl-tests.lisp
index 0f35429..689c9ff 100644
--- a/jacl-tests.lisp
+++ b/jacl-tests.lisp
@@ -167,9 +167,20 @@
 
   (do* ((x 0 (1+ x))
         (y x (1+ x)))
-       ((eql x 5) (assert= y 6))))
+       ((eql x 5) (assert= y 6)))
 
-(deftest "DO")
+  (do* ((i 0 (1+ i))
+        (j 0 i))
+       ((eql i 10)
+        (assert= i 10)
+        (assert= j 10))))
+
+(deftest "DO"
+    (do ((i 0 (1+ i))
+         (j 0 i))
+        ((eql i 10)
+         (assert= i 10)
+         (assert= j 9))))
 
 (deftest "DOLIST"
   (let ((x 0))
@@ -181,7 +192,11 @@
    (dolist (i '(1 2 3))
      (when (eql i 2)
        (return i)))
-   2))
+   2)
+  (assert= 6
+           (let ((i 0))
+             (dolist (x '(1 2 3) i)
+               (setq i (+ i x))))))
 
 (start-tests)