X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Flist.pure.lisp;h=b1f588ea4efded356f53c5d5c0a1291695409654;hb=669eaea6857ab6211bfd6c00c7d227f3263200b9;hp=c450c9f9555ac1bd148bb857ed51d99bba9d8d61;hpb=d2241edb01a6dad8a7bc1107d28d0873f5f8d83e;p=sbcl.git diff --git a/tests/list.pure.lisp b/tests/list.pure.lisp index c450c9f..b1f588e 100644 --- a/tests/list.pure.lisp +++ b/tests/list.pure.lisp @@ -106,5 +106,33 @@ (append nil (1 2) nil (3 . 4) nil) (reverse (1 2 . 3)) (nreverse (1 2 . 3)) - (nreconc (1 2 . 3) (4 5)))) - (assert (raises-error? (apply (first test) (copy-tree (rest test))) type-error))) + (nreconc (1 2 . 3) (4 5)) + (copy-alist ((1 . 2) (3 . 4) . 5)))) + (assert (raises-error? (apply (first test) (copy-tree (rest test))) + type-error))) + +;;; Bug reported by Paul Dietz: NSET-EXCLUSIVE-OR should not return +;;; extra elements, even when given "sets" contain duplications +(assert (equal (remove-duplicates (sort (nset-exclusive-or (list 1 2 1 3) + (list 4 1 3 3)) + #'<)) + '(2 4))) + +;;; Bug reported by Adam Warner: valid list index designator is not +;;; necessary a fixnum +(let ((s (read-from-string "(a . #1=(b c . #1#))"))) + (assert (eq (nth (* 1440 most-positive-fixnum) s) 'c)) + (setf (nth (* 1440 most-positive-fixnum) s) 14) + (assert (eq (nth (* 1440 most-positive-fixnum) s) 14))) + +(let ((s (copy-list '(1 2 3)))) + (assert (eq s (last s (* 1440 most-positive-fixnum)))) + (assert (null (butlast s (* 1440 most-positive-fixnum)))) + (assert (null (nbutlast s (* 1440 most-positive-fixnum))))) + +;;; Bug reported by Paul Dietz: ASSOC should ignore NIL elements in a +;;; alist +(let ((f (compile nil '(lambda (x) + (assoc x '(nil (a . b) nil (nil . c) (c . d)) + :test #'eq))))) + (assert (equal (funcall f 'nil) '(nil . c))))