comparison 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
comparison
equal deleted inserted replaced
5335:c9d31263ab7d 5336:287499ff4c5f
2788 (Check-Error args-out-of-range 2788 (Check-Error args-out-of-range
2789 (funcall function (copy-sequence string) 2789 (funcall function (copy-sequence string)
2790 (copy-sequence string) 2790 (copy-sequence string)
2791 :end1 (* 2 string-length)))))) 2791 :end1 (* 2 string-length))))))
2792 2792
2793 (let* ((list (list 1 2 3 4 5 6 7 120 'hi-there '#:everyone))
2794 (vector (map 'vector #'identity list))
2795 (bit-vector (map 'bit-vector
2796 #'(lambda (object) (if (fixnump object) 1 0)) list))
2797 (string (map 'string
2798 #'(lambda (object) (or (and (fixnump object)
2799 (int-char object))
2800 (decode-char 'ucs #x20ac))) list))
2801 (gensym (gensym)))
2802 (Assert (null (find 'not-in-it list)))
2803 (Assert (null (find 'not-in-it vector)))
2804 (Assert (null (find 'not-in-it bit-vector)))
2805 (Assert (null (find 'not-in-it string)))
2806 (loop
2807 for elt being each element in vector using (index position)
2808 do
2809 (Assert (eq elt (find elt list)))
2810 (Assert (eq (elt list position) (find elt vector))))
2811 (Assert (eq gensym (find 'not-in-it list :default gensym)))
2812 (Assert (eq gensym (find 'not-in-it vector :default gensym)))
2813 (Assert (eq gensym (find 'not-in-it bit-vector :default gensym)))
2814 (Assert (eq gensym (find 'not-in-it string :default gensym)))
2815 (Assert (eq 'hi-there (find 'hi-there list)))
2816 ;; Different uninterned symbols with the same name.
2817 (Assert (not (eq '#1=#:everyone (find '#1# list)))))
2818
2793 ;;; end of lisp-tests.el 2819 ;;; end of lisp-tests.el