0.7.9.52:
[sbcl.git] / tests / loop.pure.lisp
index 23f6691..bed64e1 100644 (file)
                            (funcall (lambda ()
                                       (loop for (a . a) in '((1 . 2) (3 . 4))
                                             return a)))))
-              'program-error))
\ No newline at end of file
+              'program-error))
+
+;;; similar to gcl/ansi-test LOOP.1.27, and fixed at the same time:
+(assert (equal (loop for x downto 7 by 2 from 13 collect x) '(13 11 9 7)))
+
+;;; some more from gcl/ansi-test:
+(let ((table (make-hash-table)))
+  (setf (gethash 'foo table) '(bar baz))
+  (assert (= (loop for nil being the hash-keys of table count t) 1))
+  (assert (equal (loop for nil being the hash-keys of table
+                              using (hash-value (v1 . v2))
+                      when v1
+                        return v2)
+                '(baz))))
+
+(assert (= (loop for nil being the external-symbols of :cl count t) 978))
+(assert (= (loop for x being the external-symbols of :cl count x) 977))
+
+(let ((*package* (find-package :cl)))
+  (assert (= (loop for x being each external-symbol count t) 978)))