Mercurial > hg > xemacs-beta
diff tests/automated/lisp-tests.el @ 5468:a9094f28f9a9
Merge with trunk.
author | Mats Lidell <matsl@xemacs.org> |
---|---|
date | Wed, 19 Jan 2011 22:35:23 +0100 |
parents | 89331fa1c819 ba62563ec7c7 |
children | 0af042a0c116 |
line wrap: on
line diff
--- a/tests/automated/lisp-tests.el Fri Jan 14 23:32:08 2011 +0100 +++ b/tests/automated/lisp-tests.el Wed Jan 19 22:35:23 2011 +0100 @@ -2788,4 +2788,44 @@ (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)))) + + ;; Test concatenate. + (Assert (equal list (concatenate 'list vector))) + (Assert (equal list (concatenate 'list (subseq vector 0 4) + (subseq list 4)))) + (Assert (equal vector (concatenate 'vector list))) + (Assert (equal vector (concatenate `(vector * ,(length vector)) list))) + (Assert (equal string (concatenate `(vector character ,(length string)) + (append string nil)))) + (Assert (equal bit-vector (concatenate 'bit-vector (subseq bit-vector 0 4) + (append (subseq bit-vector 4) nil)))) + (Assert (equal bit-vector (concatenate `(vector bit ,(length bit-vector)) + (subseq bit-vector 0 4) + (append (subseq bit-vector 4) nil))))) + ;;; end of lisp-tests.el