diff tests/automated/lisp-tests.el @ 5336:287499ff4c5f

Pass in the DEFAULT argument to position() as documented, #'find. src/ChangeLog addition: 2011-01-14 Aidan Kehoe <kehoea@parhasard.net> * fns.c (Ffind): Use the correct subr information here, pass in the DEFAULT keyword argument value correctly. tests/ChangeLog addition: 2011-01-14 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el (list): Test #'find, especially the :default keyword, not specified by Common Lisp.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 14 Jan 2011 23:16:25 +0000
parents 7b391d07b334
children ba62563ec7c7
line wrap: on
line diff
--- a/tests/automated/lisp-tests.el	Tue Jan 11 13:39:35 2011 +0000
+++ b/tests/automated/lisp-tests.el	Fri Jan 14 23:16:25 2011 +0000
@@ -2790,4 +2790,30 @@
                             (copy-sequence string)
                             :end1 (* 2 string-length))))))
 
+(let* ((list (list 1 2 3 4 5 6 7 120 'hi-there '#:everyone))
+       (vector (map 'vector #'identity list))
+       (bit-vector (map 'bit-vector
+			#'(lambda (object) (if (fixnump object) 1 0)) list))
+       (string (map 'string 
+		    #'(lambda (object) (or (and (fixnump object)
+						(int-char object))
+					   (decode-char 'ucs #x20ac))) list))
+       (gensym (gensym)))
+  (Assert (null (find 'not-in-it list)))
+  (Assert (null (find 'not-in-it vector)))
+  (Assert (null (find 'not-in-it bit-vector)))
+  (Assert (null (find 'not-in-it string)))
+  (loop
+    for elt being each element in vector using (index position)
+    do
+    (Assert (eq elt (find elt list)))
+    (Assert (eq (elt list position) (find elt vector))))
+  (Assert (eq gensym (find 'not-in-it list :default gensym)))
+  (Assert (eq gensym (find 'not-in-it vector :default gensym)))
+  (Assert (eq gensym (find 'not-in-it bit-vector :default gensym)))
+  (Assert (eq gensym (find 'not-in-it string :default gensym)))
+  (Assert (eq 'hi-there (find 'hi-there list)))
+  ;; Different uninterned symbols with the same name.
+  (Assert (not (eq '#1=#:everyone (find '#1# list)))))
+
 ;;; end of lisp-tests.el