+
+;;; bug reported by Dan Corkill: *PRINT-CASE* affected the compiler transforms
+;;; for ASSOC & MEMBER
+(let ((*print-case* :downcase))
+ (assert (eql 2 (cdr (funcall (compile nil '(lambda (i l) (assoc i l)))
+ :b '((:a . 1) (:b . 2))))))
+ (assert (equal '(3 4 5) (funcall (compile nil '(lambda (i l) (member i l)))
+ 3 '(1 2 3 4 5)))))
+
+;;; bad bounding index pair to SUBSEQ on a list
+(let ((list (list 0 1 2 3 4 5)))
+ (multiple-value-bind (res err) (ignore-errors (subseq list 4 2))
+ (assert (not res))
+ (assert (typep err 'sb-kernel:bounding-indices-bad-error))))
+
+;;; ADJOIN must apply key to item as well
+(assert (equal '((:b)) (funcall
+ (compile nil '(lambda (x y) (adjoin x y :key #'car :test #'string=)))
+ (list 'b) (list '(:b)))))
+(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 #'<))
+