1.0.16.37: fix bug #206 -- SB-FLUID build works once more
[sbcl.git] / tests / list.pure.lisp
index 66882ea..555b0c2 100644 (file)
 (assert (equal '((:b))
                (let ((sb-ext:*evaluator-mode* :interpret))
                  (eval '(adjoin (list 'b) (list '(:b)) :key #'car :test #'string=)))))
+
+;;; constant list argument to ADJOIN
+(assert (equal '(:x :y) (funcall
+                         (compile nil '(lambda (elt)
+                                        (declare (optimize speed))
+                                        (adjoin elt '(:x :y))))
+                         ':x)))
+(assert (equal '(:x :y) (funcall
+                         (compile nil '(lambda (elt)
+                                        (declare (optimize speed))
+                                        (adjoin elt '(:y))))
+                         ':x)))
+
+
+(macrolet ((test (expected list-1 list-2 &rest args)
+             `(progn
+                (assert (equal ,expected (funcall #'union ,list-1 ,list-2 ,@args)))
+                (assert (equal ,expected (funcall #'nunion
+                                                  (copy-list ,list-1)
+                                                  (copy-list ,list-2)
+                                                  ,@args))))))
+  (test nil nil nil)
+  (test '(42) nil '(42))
+  (test '(42) '(42) nil)
+  (test '(42) '(42) '(42))
+  (test '((42) (42)) '((42)) '((42)))
+  (test '((42) (42)) '((42)) '((42)) :test-not #'equal)
+  (test '((42)) '((42)) '((42)) :test #'equal)
+  (test '((42)) '((42)) '((42)) :key #'car)
+  (test '((42)) '((42)) '((42)) :key #'car :test-not #'<))
+