From 0e1870a4b3463f2487fba42f7fe1e281f4d99ae4 Mon Sep 17 00:00:00 2001
From: pfdietz <pfdietz@localhost>
Date: Sat, 22 Feb 2003 01:15:59 +0000
Subject: [PATCH] Added fallback ERROR case to classify-error.  Added numerous
 tests to check that safe calls inside builtin functions that take function
 parameters are truly safe.

---
 ansi-tests/ansi-aux.lsp           |  1 +
 ansi-tests/apply.lsp              |  4 ++
 ansi-tests/complement.lsp         |  8 ++++
 ansi-tests/concatenate.lsp        | 14 ++----
 ansi-tests/cons-test-02.lsp       | 78 +++++++++++++++++++++++++++++++
 ansi-tests/cons-test-04.lsp       | 30 ++++++++++++
 ansi-tests/cons-test-13.lsp       | 12 +++++
 ansi-tests/cons-test-14.lsp       | 16 +++++++
 ansi-tests/cons-test-15.lsp       | 74 +++++++++++++++++++++++++++++
 ansi-tests/cons-test-16.lsp       | 45 ++++++++++++++++++
 ansi-tests/cons-test-17.lsp       | 46 +++++++++++++++++-
 ansi-tests/cons-test-19.lsp       | 34 +++++++++++++-
 ansi-tests/cons-test-20.lsp       | 20 +++++++-
 ansi-tests/cons-test-21.lsp       | 19 +++++++-
 ansi-tests/cons-test-22.lsp       | 33 +++++++++++++
 ansi-tests/cons-test-23.lsp       | 34 ++++++++++++++
 ansi-tests/cons-test-24.lsp       | 16 +++++++
 ansi-tests/count-if-not.lsp       | 16 +++++++
 ansi-tests/count-if.lsp           | 18 +++++++
 ansi-tests/count.lsp              | 15 ++++++
 ansi-tests/every.lsp              | 12 +++++
 ansi-tests/find-if-not.lsp        | 16 +++++++
 ansi-tests/find-if.lsp            | 16 +++++++
 ansi-tests/find.lsp               | 17 +++++++
 ansi-tests/funcall.lsp            | 13 ++++++
 ansi-tests/map-into.lsp           |  8 ++++
 ansi-tests/map.lsp                | 12 +++++
 ansi-tests/merge.lsp              |  6 +++
 ansi-tests/mismatch.lsp           | 16 +++++++
 ansi-tests/notany.lsp             | 12 +++++
 ansi-tests/notevery.lsp           | 16 +++++++
 ansi-tests/nsubstitute-if-not.lsp | 18 +++++++
 ansi-tests/nsubstitute-if.lsp     | 19 ++++++++
 ansi-tests/nsubstitute.lsp        | 17 +++++++
 ansi-tests/position-if-not.lsp    | 16 +++++++
 ansi-tests/position-if.lsp        | 20 +++++++-
 ansi-tests/position.lsp           | 17 +++++++
 ansi-tests/reduce.lsp             | 13 ++++++
 ansi-tests/remove-duplicates.lsp  | 32 ++++++++++++-
 ansi-tests/remove.lsp             | 34 ++++++++++++++
 ansi-tests/search-list.lsp        | 16 +++++++
 ansi-tests/some.lsp               | 14 ++++++
 ansi-tests/sort.lsp               | 16 +++++++
 ansi-tests/stable-sort.lsp        | 18 ++++++-
 ansi-tests/substitute-if-not.lsp  | 19 ++++++++
 ansi-tests/substitute-if.lsp      | 18 +++++++
 ansi-tests/substitute.lsp         | 17 +++++++
 47 files changed, 963 insertions(+), 18 deletions(-)

diff --git a/ansi-tests/ansi-aux.lsp b/ansi-tests/ansi-aux.lsp
index 49cab6dd..904cdad1 100644
--- a/ansi-tests/ansi-aux.lsp
+++ b/ansi-tests/ansi-aux.lsp
@@ -279,6 +279,7 @@ the condition to go uncaught if it cannot be classified."
      (file-error    () 'file-error)
      (control-error () 'control-error)
      (cell-error    () 'cell-error)
+     (error         () 'error)
   )))
 
 (defun classify-error** (form)
diff --git a/ansi-tests/apply.lsp b/ansi-tests/apply.lsp
index b403ff7a..d796c36f 100644
--- a/ansi-tests/apply.lsp
+++ b/ansi-tests/apply.lsp
@@ -19,6 +19,10 @@
   (classify-error (apply #'cons nil))
   program-error)
 
+(deftest apply.error.4
+  (classify-errir (apply #'cons (list 1 2 3)))
+  program-error)
+
 ;;; Non-error cases
 
 (deftest apply.1
diff --git a/ansi-tests/complement.lsp b/ansi-tests/complement.lsp
index e387c0c6..0fee0a8c 100644
--- a/ansi-tests/complement.lsp
+++ b/ansi-tests/complement.lsp
@@ -47,3 +47,11 @@
 (deftest complement.error.2
   (classify-error (complement #'not t))
   program-error)
+
+(deftest complement.error.3
+  (classify-error (funcall (complement #'identity)))
+  program-error)
+
+(deftest complement.error.4
+  (classify-error (funcall (complement #'identity) t t))
+  program-error)
diff --git a/ansi-tests/concatenate.lsp b/ansi-tests/concatenate.lsp
index de8fefa1..6fdb214f 100644
--- a/ansi-tests/concatenate.lsp
+++ b/ansi-tests/concatenate.lsp
@@ -207,18 +207,12 @@
 ;;; Error tests
 
 (deftest concatenate.error.1
-  (handler-case
-   (progn (proclaim '(optimize (safety 3)))
-	  (eval '(concatenate 'sequence '(a b c))))
-   (error () :caught))
-  :caught)
+  (subtypep* (classify-error (concatenate 'sequence '(a b c))) 'error)
+  t t)
 
 (deftest concatenate.error.2
-  (handler-case
-      (progn (proclaim '(optimize (safety 3)))
-	     (concatenate 'fixnum '(a b c d e)))
-      (error () :caught))
-  :caught)
+  (subtypep* (classify-error (concatenate 'fixnum '(a b c d e))) 'error)
+  t t)
 
 (deftest concatenate.error.3
   (classify-error (concatenate '(vector * 3) '(a b c d e)))
diff --git a/ansi-tests/cons-test-02.lsp b/ansi-tests/cons-test-02.lsp
index 117c1aaa..cdcecef2 100644
--- a/ansi-tests/cons-test-02.lsp
+++ b/ansi-tests/cons-test-02.lsp
@@ -181,6 +181,24 @@
   (classify-error (sublis nil 'a :bad-keyword t))
   program-error)
 
+(deftest sublis.error.5
+  (classify-error (sublis '((a . 1) (b . 2))
+			  (list 'a 'b 'c 'd)
+			  :test #'identity))
+  program-error)
+
+(deftest sublis.error.6
+  (classify-error (sublis '((a . 1) (b . 2))
+			  (list 'a 'b 'c 'd)
+			  :key #'cons))
+  program-error)
+
+(deftest sublis.error.7
+  (classify-error (sublis '((a . 1) (b . 2))
+			  (list 'a 'b 'c 'd)
+			  :test-not #'identity))
+  program-error)
+
 ;; nsublis
 
 (deftest nsublis.1
@@ -321,6 +339,25 @@
   (classify-error (nsublis nil 'a :bad-keyword t))
   program-error)
 
+(deftest nsublis.error.5
+  (classify-error (nsublis '((a . 1) (b . 2))
+			   (list 'a 'b 'c 'd)
+			   :test #'identity))
+  program-error)
+
+(deftest nsublis.error.6
+  (classify-error (nsublis '((a . 1) (b . 2))
+			   (list 'a 'b 'c 'd)
+			   :key #'cons))
+  program-error)
+
+(deftest nsublis.error.7
+  (classify-error (nsublis '((a . 1) (b . 2))
+			   (list 'a 'b 'c 'd)
+			   :test-not #'identity))
+  program-error)
+
+;;;;;;
 
 (deftest sublis.shared
   (let* ((shared-piece (list 'a 'b))
@@ -891,6 +928,18 @@
   (classify-error (subst 'a 'b nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest subst.error.8
+  (classify-error (subst 'a 'b (list 'a 'b) :test #'identity))
+  program-error)
+
+(deftest subst.error.9
+  (classify-error (subst 'a 'b (list 'a 'b) :test-not #'identity))
+  program-error)
+
+(deftest subst.error.10
+  (classify-error (subst 'a 'b (list 'a 'b) :key #'equal))
+  program-error)
+
 ;;; nsubst
 (deftest nsubst.error.1
   (classify-error (nsubst))
@@ -920,6 +969,18 @@
   (classify-error (nsubst 'a 'b nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest nsubst.error.8
+  (classify-error (nsubst 'a 'b (list 'a 'b) :test #'identity))
+  program-error)
+
+(deftest nsubst.error.9
+  (classify-error (nsubst 'a 'b (list 'a 'b) :test-not #'identity))
+  program-error)
+
+(deftest nsubst.error.10
+  (classify-error (nsubst 'a 'b (list 'a 'b) :key #'equal))
+  program-error)
+
 ;;; subst-if
 (deftest subst-if.error.1
   (classify-error (subst-if))
@@ -949,6 +1010,10 @@
   (classify-error (subst-if 'a #'null nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest subst-if.error.8
+  (classify-error (subst-if 'a #'null (list 'a nil 'c) :key #'cons))
+  program-error)
+
 ;;; subst-if-not
 (deftest subst-if-not.error.1
   (classify-error (subst-if-not))
@@ -979,6 +1044,10 @@
 				:bad t :allow-other-keys nil))
   program-error)
 
+(deftest subst-if-not.error.8
+  (classify-error (subst-if-not 'a #'null (list 'a nil 'c) :key #'cons))
+  program-error)
+
 ;;; nsubst-if
 (deftest nsubst-if.error.1
   (classify-error (nsubst-if))
@@ -1008,6 +1077,10 @@
   (classify-error (nsubst-if 'a #'null nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest nsubst-if.error.8
+  (classify-error (nsubst-if 'a #'null (list 'a nil 'c) :key #'cons))
+  program-error)
+
 
 ;;; nsubst-if-not
 (deftest nsubst-if-not.error.1
@@ -1038,3 +1111,8 @@
   (classify-error (nsubst-if-not 'a #'null nil
 				 :bad t :allow-other-keys nil))
   program-error)
+
+(deftest nsubst-if-not.error.8
+  (classify-error (nsubst-if-not 'a #'null (list 'a nil 'c) :key #'cons))
+  program-error)
+
diff --git a/ansi-tests/cons-test-04.lsp b/ansi-tests/cons-test-04.lsp
index 2846d520..c605428c 100644
--- a/ansi-tests/cons-test-04.lsp
+++ b/ansi-tests/cons-test-04.lsp
@@ -229,6 +229,24 @@
   (a b c) (a b c)
   3 1 3 2)
 
+(deftest pushnew.error.1
+  (classify-error
+   (let ((x '(a b)))
+     (pushnew 'c x :test #'identity)))
+  program-error)
+
+(deftest pushnew.error.2
+  (classify-error
+   (let ((x '(a b)))
+     (pushnew 'c x :test-not #'identity)))
+  program-error)
+
+(deftest pushnew.error.3
+  (classify-error
+   (let ((x '(a b)))
+     (pushnew 'c x :key #'cons)))
+  program-error)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; adjoin
 
@@ -381,3 +399,15 @@
 (deftest adjoin.error.6
   (classify-error (adjoin 'a '(b c) :test))
   program-error)
+
+(deftest adjoin.error.7
+  (classify-error (adjoin 'a '(b c) :test #'identity))
+  program-error)
+
+(deftest adjoin.error.8
+  (classify-error (adjoin 'a '(b c) :test-not #'identity))
+  program-error)
+
+(deftest adjoin.error.9
+  (classify-error (adjoin 'a '(b c) :key #'cons))
+  program-error)
diff --git a/ansi-tests/cons-test-13.lsp b/ansi-tests/cons-test-13.lsp
index d2f65eb7..b1f699e2 100644
--- a/ansi-tests/cons-test-13.lsp
+++ b/ansi-tests/cons-test-13.lsp
@@ -278,3 +278,15 @@
 (deftest member.error.14
   (classify-error (locally (member 'a t) t))
   type-error)
+
+(deftest member.error.15
+  (classify-error (member 'a '(a b c) :test #'identity))
+  program-error)
+
+(deftest member.error.16
+  (classify-error (member 'a '(a b c) :test-not #'identity))
+  program-error)
+
+(deftest member.error.17
+  (classify-error (member 'a '(a b c) :key #'cons))
+  program-error)
diff --git a/ansi-tests/cons-test-14.lsp b/ansi-tests/cons-test-14.lsp
index b85acb74..aaac91fa 100644
--- a/ansi-tests/cons-test-14.lsp
+++ b/ansi-tests/cons-test-14.lsp
@@ -225,6 +225,14 @@
   (classify-error (locally (member-if #'identity 'a) t))
   type-error)
 
+(deftest member-if.error.9
+  (classify-error (member-if #'cons '(a b c)))
+  program-error)
+
+(deftest member-if.error.10
+  (classify-error (member-if #'identity '(a b c) :key #'cons))
+  program-error)
+
 
 (deftest member-if-not.error.1
   (classify-error (member-if-not #'identity 'a))
@@ -257,3 +265,11 @@
 (deftest member-if-not.error.8
   (classify-error (locally (member-if-not #'identity 'a) t))
   type-error)
+
+(deftest member-if-not.error.9
+  (classify-error (member-if-not #'cons '(a b c)))
+  program-error)
+
+(deftest member-if-not.error.10
+  (classify-error (member-if-not #'identity '(a b c) :key #'cons))
+  program-error)
diff --git a/ansi-tests/cons-test-15.lsp b/ansi-tests/cons-test-15.lsp
index 9d82f3cf..f29f020c 100644
--- a/ansi-tests/cons-test-15.lsp
+++ b/ansi-tests/cons-test-15.lsp
@@ -92,6 +92,18 @@
   (classify-error (locally (mapc #'identity 1) t))
   type-error)
 
+(deftest mapc.error.5
+  (classify-error (mapc #'cons '(a b c)))
+  program-error)
+
+(deftest mapc.error.6
+  (classify-error (mapc #'cons '(a b c) '(1 2 3) '(4 5 6)))
+  program-error)
+
+(deftest mapc.error.7
+  (classify-error (mapc #'car '(a b c)))
+  type-error)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; mapcar
 
@@ -184,6 +196,19 @@
   (classify-error (locally (mapcar #'identity 1) t))
   type-error)
 
+(deftest mapcar.error.5
+  (classify-error (mapcar #'car '(a b c)))
+  type-error)
+
+(deftest mapcar.error.6
+  (classify-error (mapcar #'cons '(a b c)))
+  program-error)
+
+(deftest mapcar.error.7
+  (classify-error (mapcar #'cons '(a b c) '(1 2 3) '(4 5 6)))
+  program-error)
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; mapcan
 
@@ -283,6 +308,18 @@
   (classify-error (locally (mapcan #'identity 1) t))
   type-error)
 
+(deftest mapcan.error.5
+  (classify-error (mapcan #'car '(a b c)))
+  type-error)
+
+(deftest mapcan.error.6
+  (classify-error (mapcan #'cons '(a b c)))
+  program-error)
+
+(deftest mapcan.error.7
+  (classify-error (mapcan #'cons '(a b c) '(1 2 3) '(4 5 6)))
+  program-error)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; mapl
 
@@ -394,6 +431,19 @@
   (classify-error (locally (mapl #'identity 1) t))
   type-error)
 
+(deftest mapl.error.5
+  (classify-error (mapl #'cons '(a b c)))
+  program-error)
+
+(deftest mapl.error.6
+  (classify-error (mapl #'cons '(a b c) '(1 2 3) '(4 5 6)))
+  program-error)
+
+(deftest mapl.error.7
+  (classify-error (mapl #'caar '(a b c)))
+  type-error)
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; maplist
 
@@ -512,6 +562,18 @@
   (classify-error (locally (maplist #'identity 'a) t))
   type-error)
 
+(deftest maplist.error.8
+  (classify-error (maplist #'caar '(a b c)))
+  type-error)
+
+(deftest maplist.error.9
+  (classify-error (maplist #'cons '(a b c)))
+  program-error)
+
+(deftest maplist.error.10
+  (classify-error (maplist #'cons '(a b c) '(1 2 3) '(4 5 6)))
+  program-error)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; mapcon
 
@@ -576,3 +638,15 @@
 (deftest mapcon.error.4
   (classify-error (locally (mapcon #'identity 1) t))
   type-error)
+
+(deftest mapcon.error.5
+  (classify-error (mapcon #'caar '(a b c)))
+  type-error)
+
+(deftest mapcon.error.6
+  (classify-error (mapcon #'cons '(a b c)))
+  program-error)
+
+(deftest mapcon.error.7
+  (classify-error (mapcon #'cons '(a b c) '(1 2 3) '(4 5 6)))
+  program-error)
diff --git a/ansi-tests/cons-test-16.lsp b/ansi-tests/cons-test-16.lsp
index 0210a2ad..e51f8c6c 100644
--- a/ansi-tests/cons-test-16.lsp
+++ b/ansi-tests/cons-test-16.lsp
@@ -298,6 +298,18 @@
   (classify-error (assoc nil nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest assoc.error.7
+  (classify-error (assoc 'a '((a . b)) :test #'identity))
+  program-error)
+
+(deftest assoc.error.8
+  (classify-error (assoc 'a '((a . b)) :test-not #'identity))
+  program-error)
+
+(deftest assoc.error.9
+  (classify-error (assoc 'a '((a . b)) :key #'cons))
+  program-error)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; assoc-if
 
@@ -414,6 +426,23 @@
   (classify-error (assoc-if #'null nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest assoc-if.error.7
+  (classify-error (assoc-if #'cons '((a b)(c d))))
+  program-error)
+
+(deftest assoc-if.error.8
+  (classify-error (assoc-if #'identity '((a b)(c d)) :key #'cons))
+  program-error)
+
+(deftest assoc-if.error.9
+  (classify-error (assoc-if #'car '((a b)(c d))))
+  type-error)
+
+(deftest assoc-if.error.10
+  (classify-error (assoc-if #'identity '((a b)(c d)) :key #'car))
+  type-error)
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; assoc-if-not
 
@@ -532,6 +561,22 @@
   (classify-error (assoc-if-not #'null nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest assoc-if-not.error.7
+  (classify-error (assoc-if-not #'cons '((a b)(c d))))
+  program-error)
+
+(deftest assoc-if-not.error.8
+  (classify-error (assoc-if-not #'identity '((a b)(c d)) :key #'cons))
+  program-error)
+
+(deftest assoc-if-not.error.9
+  (classify-error (assoc-if-not #'car '((a b)(c d))))
+  type-error)
+
+(deftest assoc-if-not.error.10
+  (classify-error (assoc-if-not #'identity '((a b)(c d)) :key #'car))
+  type-error)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; copy-alist
 
diff --git a/ansi-tests/cons-test-17.lsp b/ansi-tests/cons-test-17.lsp
index f489bf06..8d34468a 100644
--- a/ansi-tests/cons-test-17.lsp
+++ b/ansi-tests/cons-test-17.lsp
@@ -283,6 +283,18 @@
   (classify-error (rassoc nil nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest rassoc.error.7
+  (classify-error (rassoc 'a '((b . a)(c . d)) :test #'identity))
+  program-error)
+
+(deftest rassoc.error.8
+  (classify-error (rassoc 'a '((b . a)(c . d)) :test-not #'identity))
+  program-error)
+
+(deftest rassoc.error.9
+  (classify-error (rassoc 'a '((b . a)(c . d)) :key #'cons))
+  program-error)
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; rassoc-if
@@ -397,6 +409,22 @@
   (classify-error (rassoc-if #'null nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest rassoc-if.error.7
+  (classify-error (rassoc-if #'cons '((a . b)(c . d))))
+  program-error)
+
+(deftest rassoc-if.error.8
+  (classify-error (rassoc-if #'car '((a . b)(c . d))))
+  type-error)
+
+(deftest rassoc-if.error.9
+  (classify-error (rassoc-if #'identity '((a . b)(c . d)) :key #'cons))
+  program-error)
+
+(deftest rassoc-if.error.10
+  (classify-error (rassoc-if #'identity '((a . b)(c . d)) :key #'car))
+  type-error)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; rassoc-if-not
 
@@ -512,4 +540,20 @@
 
 (deftest rassoc-if-not.error.6
   (classify-error (rassoc-if-not #'null nil :bad t :allow-other-keys nil))
-  program-error)
\ No newline at end of file
+  program-error)
+
+(deftest rassoc-if-not.error.7
+  (classify-error (rassoc-if-not #'cons '((a . b)(c . d))))
+  program-error)
+
+(deftest rassoc-if-not.error.8
+  (classify-error (rassoc-if-not #'car '((a . b)(c . d))))
+  type-error)
+
+(deftest rassoc-if-not.error.9
+  (classify-error (rassoc-if-not #'identity '((a . b)(c . d)) :key #'cons))
+  program-error)
+
+(deftest rassoc-if-not.error.10
+  (classify-error (rassoc-if-not #'identity '((a . b)(c . d)) :key #'car))
+  type-error)
diff --git a/ansi-tests/cons-test-19.lsp b/ansi-tests/cons-test-19.lsp
index b3987d3d..c0d0e4bb 100644
--- a/ansi-tests/cons-test-19.lsp
+++ b/ansi-tests/cons-test-19.lsp
@@ -372,6 +372,22 @@
   (classify-error (intersection nil nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest intersection.error.7
+  (classify-error (intersection '(a b c) '(d e f) :test #'identity))
+  program-error)
+
+(deftest intersection.error.8
+  (classify-error (intersection '(a b c) '(d e f) :test-not #'identity))
+  program-error)
+
+(deftest intersection.error.9
+  (classify-error (intersection '(a b c) '(d e f) :key #'cons))
+  program-error)
+
+(deftest intersection.error.10
+  (classify-error (intersection '(a b c) '(d e f) :key #'car))
+  type-error)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; nintersection
 
@@ -703,4 +719,20 @@
 
 (deftest nintersection.error.6
   (classify-error (nintersection nil nil :bad t :allow-other-keys nil))
-  program-error)
\ No newline at end of file
+  program-error)
+
+(deftest nintersection.error.7
+  (classify-error (nintersection (list 1 2 3) (list 4 5 6) :test #'identity))
+  program-error)
+
+(deftest nintersection.error.8
+  (classify-error (nintersection (list 1 2 3) (list 4 5 6) :test-not #'identity))
+  program-error)
+
+(deftest nintersection.error.9
+  (classify-error (nintersection (list 1 2 3) (list 4 5 6) :key #'cons))
+  program-error)
+
+(deftest nintersection.error.10
+  (classify-error (nintersection (list 1 2 3) (list 4 5 6) :key #'car))
+  type-error)
diff --git a/ansi-tests/cons-test-20.lsp b/ansi-tests/cons-test-20.lsp
index e61b5e48..e62d3fe2 100644
--- a/ansi-tests/cons-test-20.lsp
+++ b/ansi-tests/cons-test-20.lsp
@@ -383,4 +383,22 @@
 
 (deftest union.error.6
   (classify-error (union nil nil :bad t :allow-other-keys nil))
-  program-error)
\ No newline at end of file
+  program-error)
+
+(deftest union.error.7
+  (classify-error (union (list 1 2) (list 3 4) :test #'identity))
+  program-error)
+
+(deftest union.error.8
+  (classify-error (union (list 1 2) (list 3 4) :test-not #'identity))
+  program-error)
+
+(deftest union.error.9
+  (classify-error (union (list 1 2) (list 3 4) :key #'cons))
+  program-error)
+
+(deftest union.error.10
+  (classify-error (union (list 1 2) (list 3 4) :key #'car))
+  type-error)
+
+
diff --git a/ansi-tests/cons-test-21.lsp b/ansi-tests/cons-test-21.lsp
index ef5c39a7..7a6a3ae0 100644
--- a/ansi-tests/cons-test-21.lsp
+++ b/ansi-tests/cons-test-21.lsp
@@ -382,4 +382,21 @@
 
 (deftest nunion.error.6
   (classify-error (nunion nil nil :bad t :allow-other-keys nil))
-  program-error)
\ No newline at end of file
+  program-error)
+
+(deftest nunion.error.7
+  (classify-error (nunion (list 1 2) (list 3 4) :test #'identity))
+  program-error)
+
+(deftest nunion.error.8
+  (classify-error (nunion (list 1 2) (list 3 4) :test-not #'identity))
+  program-error)
+
+(deftest nunion.error.9
+  (classify-error (nunion (list 1 2) (list 3 4) :key #'cons))
+  program-error)
+
+(deftest nunion.error.10
+  (classify-error (nunion (list 1 2) (list 3 4) :key #'car))
+  type-error)
+
diff --git a/ansi-tests/cons-test-22.lsp b/ansi-tests/cons-test-22.lsp
index 8ead25af..3c7a3a40 100644
--- a/ansi-tests/cons-test-22.lsp
+++ b/ansi-tests/cons-test-22.lsp
@@ -294,6 +294,23 @@
   (classify-error (set-difference nil nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest set-difference.error.7
+  (classify-error (set-difference (list 1 2) (list 3 4) :test #'identity))
+  program-error)
+
+(deftest set-difference.error.8
+  (classify-error (set-difference (list 1 2) (list 3 4) :test-not #'identity))
+  program-error)
+
+(deftest set-difference.error.9
+  (classify-error (set-difference (list 1 2) (list 3 4) :key #'cons))
+  program-error)
+
+(deftest set-difference.error.10
+  (classify-error (set-difference (list 1 2) (list 3 4) :key #'car))
+  type-error)
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; nset-difference
 
@@ -578,3 +595,19 @@
 (deftest nset-difference.error.6
   (classify-error (nset-difference nil nil :bad t :allow-other-keys nil))
   program-error)
+
+(deftest nset-difference.error.7
+  (classify-error (nset-difference (list 1 2) (list 3 4) :test #'identity))
+  program-error)
+
+(deftest nset-difference.error.8
+  (classify-error (nset-difference (list 1 2) (list 3 4) :test-not #'identity))
+  program-error)
+
+(deftest nset-difference.error.9
+  (classify-error (nset-difference (list 1 2) (list 3 4) :key #'cons))
+  program-error)
+
+(deftest nset-difference.error.10
+  (classify-error (nset-difference (list 1 2) (list 3 4) :key #'car))
+  type-error)
diff --git a/ansi-tests/cons-test-23.lsp b/ansi-tests/cons-test-23.lsp
index be6e92ea..039dbcd0 100644
--- a/ansi-tests/cons-test-23.lsp
+++ b/ansi-tests/cons-test-23.lsp
@@ -331,6 +331,23 @@
   (classify-error (set-exclusive-or nil nil :bad t :allow-other-keys nil))
   program-error)
 
+(deftest set-exclusive-or.error.7
+  (classify-error (set-exclusive-or (list 1 2) (list 3 4) :test #'identity))
+  program-error)
+
+(deftest set-exclusive-or.error.8
+  (classify-error (set-exclusive-or (list 1 2) (list 3 4) :test-not #'identity))
+  program-error)
+
+(deftest set-exclusive-or.error.9
+  (classify-error (set-exclusive-or (list 1 2) (list 3 4) :key #'cons))
+  program-error)
+
+(deftest set-exclusive-or.error.10
+  (classify-error (set-exclusive-or (list 1 2) (list 3 4) :key #'car))
+  type-error)
+
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; nset-exclusive-or
@@ -657,3 +674,20 @@
 (deftest nset-exclusive-or.error.6
   (classify-error (nset-exclusive-or nil nil :bad t :allow-other-keys nil))
   program-error)
+
+(deftest nset-exclusive-or.error.7
+  (classify-error (nset-exclusive-or (list 1 2) (list 3 4) :test #'identity))
+  program-error)
+
+(deftest nset-exclusive-or.error.8
+  (classify-error (nset-exclusive-or (list 1 2) (list 3 4) :test-not #'identity))
+  program-error)
+
+(deftest nset-exclusive-or.error.9
+  (classify-error (nset-exclusive-or (list 1 2) (list 3 4) :key #'cons))
+  program-error)
+
+(deftest nset-exclusive-or.error.10
+  (classify-error (nset-exclusive-or (list 1 2) (list 3 4) :key #'car))
+  type-error)
+
diff --git a/ansi-tests/cons-test-24.lsp b/ansi-tests/cons-test-24.lsp
index 806aaff4..0cde9492 100644
--- a/ansi-tests/cons-test-24.lsp
+++ b/ansi-tests/cons-test-24.lsp
@@ -232,3 +232,19 @@
 (deftest subsetp.error.6
   (classify-error (subsetp nil nil :bad t :allow-other-keys nil))
   program-error)
+
+(deftest subsetp.error.7
+  (classify-error (subsetp (list 1 2) (list 3 4) :test #'identity))
+  program-error)
+
+(deftest subsetp.error.8
+  (classify-error (subsetp (list 1 2) (list 3 4) :test-not #'identity))
+  program-error)
+
+(deftest subsetp.error.9
+  (classify-error (subsetp (list 1 2) (list 3 4) :key #'cons))
+  program-error)
+
+(deftest subsetp.error.10
+  (classify-error (subsetp (list 1 2) (list 3 4) :key #'car))
+  type-error)
\ No newline at end of file
diff --git a/ansi-tests/count-if-not.lsp b/ansi-tests/count-if-not.lsp
index 2e5603c2..bdcf63d8 100644
--- a/ansi-tests/count-if-not.lsp
+++ b/ansi-tests/count-if-not.lsp
@@ -522,3 +522,19 @@
 (deftest count-if-not.error.11
   (classify-error (locally (count-if-not #'identity 1) t))
   type-error)
+
+(deftest count-if-not.error.12
+  (classify-error (count-if-not #'cons '(a b c)))
+  program-error)
+
+(deftest count-if-not.error.13
+  (classify-error (count-if-not #'car '(a b c)))
+  type-error)
+
+(deftest count-if-not.error.14
+  (classify-error (count-if-not #'identity '(a b c) :key #'cdr))
+  type-error)
+
+(deftest count-if-not.error.15
+  (classify-error (count-if-not #'identity '(a b c) :key #'cons))
+  program-error)
diff --git a/ansi-tests/count-if.lsp b/ansi-tests/count-if.lsp
index cbc32e87..3226584e 100644
--- a/ansi-tests/count-if.lsp
+++ b/ansi-tests/count-if.lsp
@@ -521,3 +521,21 @@
 (deftest count-if.error.11
   (classify-error (locally (count-if #'identity 1) t))
   type-error)
+
+(deftest count-if.error.12
+  (classify-error (count-if #'cons '(a b c)))
+  program-error)
+
+(deftest count-if.error.13
+  (classify-error (count-if #'car '(a b c)))
+  type-error)
+
+(deftest count-if.error.14
+  (classify-error (count-if #'identity '(a b c) :key #'cdr))
+  type-error)
+
+(deftest count-if.error.15
+  (classify-error (count-if #'identity '(a b c) :key #'cons))
+  program-error)
+
+
diff --git a/ansi-tests/count.lsp b/ansi-tests/count.lsp
index e75daf4c..ede89ed4 100644
--- a/ansi-tests/count.lsp
+++ b/ansi-tests/count.lsp
@@ -592,3 +592,18 @@
   (classify-error (locally (count 'a 1) t))
   type-error)
 
+(deftest count.error.12
+  (classify-error (count 'b '(a b c) :test #'identity))
+  program-error)
+
+(deftest count.error.13
+  (classify-error (count 'b '(a b c) :key #'car))
+  type-error)
+
+(deftest count.error.14
+  (classify-error (count 'b '(a b c) :test-not #'identity))
+  program-error)
+
+(deftest count.error.15
+  (classify-error (count 'b '(a b c) :key #'cons))
+  program-error)
diff --git a/ansi-tests/every.lsp b/ansi-tests/every.lsp
index a09c8047..412fb158 100644
--- a/ansi-tests/every.lsp
+++ b/ansi-tests/every.lsp
@@ -136,3 +136,15 @@
 (deftest every.error.10
   (classify-error (locally (every 1 '(a b c)) t))
   type-error)
+
+(deftest every.error.11
+  (classify-error (every #'cons '(a b c)))
+  program-error)
+
+(deftest every.error.12
+  (classify-error (every #'cons '(a b c) '(1 2 3) '(4 5 6)))
+  program-error)
+
+(deftest every.error.13
+  (classify-error (every #'car '(a b c)))
+  type-error)
diff --git a/ansi-tests/find-if-not.lsp b/ansi-tests/find-if-not.lsp
index 9e026325..7d5e7b29 100644
--- a/ansi-tests/find-if-not.lsp
+++ b/ansi-tests/find-if-not.lsp
@@ -557,6 +557,22 @@
   (classify-error (locally (find-if-not #'null 'b) t))
   type-error)
 
+(deftest find-if-not.error.12
+  (classify-error (find-if-not #'cons '(a b c)))
+  program-error)
+
+(deftest find-if-not.error.13
+  (classify-error (find-if-not #'car '(a b c)))
+  type-error)
+
+(deftest find-if-not.error.14
+  (classify-error (find-if-not #'identity '(a b c) :key #'cons))
+  program-error)
+
+(deftest find-if-not.error.15
+  (classify-error (find-if-not #'identity '(a b c) :key #'car))
+  type-error)
+
 ;;; Order of evaluation tests
 
 (deftest find-if-not.order.1
diff --git a/ansi-tests/find-if.lsp b/ansi-tests/find-if.lsp
index edc1daf3..71e2a0dc 100644
--- a/ansi-tests/find-if.lsp
+++ b/ansi-tests/find-if.lsp
@@ -580,6 +580,22 @@
   (classify-error (locally (find-if #'null 'b) t))
   type-error)
 
+(deftest find-if.error.12
+  (classify-error (find-if #'cons '(a b c)))
+  program-error)
+
+(deftest find-if.error.13
+  (classify-error (find-if #'car '(a b c)))
+  type-error)
+
+(deftest find-if.error.14
+  (classify-error (find-if #'identity '(a b c) :key #'cons))
+  program-error)
+
+(deftest find-if.error.15
+  (classify-error (find-if #'identity '(a b c) :key #'car))
+  type-error)
+
 ;;; Order of evaluation tests
 
 (deftest find-if.order.1
diff --git a/ansi-tests/find.lsp b/ansi-tests/find.lsp
index 7ed78128..c9de8b08 100644
--- a/ansi-tests/find.lsp
+++ b/ansi-tests/find.lsp
@@ -816,6 +816,23 @@
   (classify-error (locally (find 'a 'b) t))
   type-error)
 
+(deftest find.error.12
+  (classify-error (find 'b '(a b c) :test #'identity))
+  program-error)
+
+(deftest find.error.13
+  (classify-error (find 'b '(a b c) :test-not #'identity))
+  program-error)
+
+(deftest find.error.14
+  (classify-error (find 'c '(a b c) :key #'cons))
+  program-error)
+
+(deftest find.error.15
+  (classify-error (find 'c '(a b c) :key #'car))
+  type-error)
+
+
 ;;; Order of evaluation tests
 
 (deftest find.order.1
diff --git a/ansi-tests/funcall.lsp b/ansi-tests/funcall.lsp
index 82be6496..f39e4fda 100644
--- a/ansi-tests/funcall.lsp
+++ b/ansi-tests/funcall.lsp
@@ -90,3 +90,16 @@
   (classify-error (funcall))
   program-error)
 
+(deftest funcall.error.5
+  (classify-error (funcall #'cons))
+  program-error)
+
+(deftest funcall.error.6
+  (classify-error (funcall #'cons 1))
+  program-error)
+
+(deftest funcall.error.7
+  (classify-error (funcall #'car 'a))
+  type-error)
+
+
diff --git a/ansi-tests/map-into.lsp b/ansi-tests/map-into.lsp
index 8488356a..53e034b8 100644
--- a/ansi-tests/map-into.lsp
+++ b/ansi-tests/map-into.lsp
@@ -371,6 +371,14 @@
   (classify-error (locally (map-into 'a #'(lambda () nil)) t))
   type-error)
 
+(deftest map-into.error.7
+  (classify-error (map-into (list 'a 'b 'c) #'cons '(a b c)))
+  program-error)
+
+(deftest map-into.error.8
+  (classify-error (map-into (list 'a 'b 'c) #'car '(a b c)))
+  type-error)
+
 ;;; Order of evaluation tests
 
 (deftest map-into.order.1
diff --git a/ansi-tests/map.lsp b/ansi-tests/map.lsp
index e87ac49d..11316ccc 100644
--- a/ansi-tests/map.lsp
+++ b/ansi-tests/map.lsp
@@ -189,6 +189,18 @@
   (classify-error (map 'list #'null))
   program-error)
 
+(deftest map.error.7
+  (classify-error (map 'list #'cons '(a b c d)))
+  program-error)
+
+(deftest map.error.8
+  (classify-error (map 'list #'cons '(a b c d) '(1 2 3 4) '(5 6 7 8)))
+  program-error)
+
+(deftest map.error.9
+  (classify-error (map 'list #'car '(a b c d)))
+  type-error)
+
 
 ;;; Test mapping on arrays with fill pointers
 
diff --git a/ansi-tests/merge.lsp b/ansi-tests/merge.lsp
index d7d28bb6..688c8d8f 100644
--- a/ansi-tests/merge.lsp
+++ b/ansi-tests/merge.lsp
@@ -563,4 +563,10 @@
 			   t))
   type-error)
 
+(deftest merge.error.16
+  (classify-error (merge 'list (list 1 2) (list 3 4) #'car))
+  program-error)
 
+(deftest merge.error.17
+  (classify-error (merge 'list (list 'a 'b) (list 3 4) #'max))
+  type-error)
diff --git a/ansi-tests/mismatch.lsp b/ansi-tests/mismatch.lsp
index 589a9190..2f9b4c34 100644
--- a/ansi-tests/mismatch.lsp
+++ b/ansi-tests/mismatch.lsp
@@ -697,3 +697,19 @@
 (deftest mismatch.error.6
   (classify-error (mismatch nil nil 1 2))
   program-error)
+
+(deftest mismatch.error.7
+  (classify-error (mismatch '(a b) '(a b) :test #'identity))
+  program-error)
+
+(deftest mismatch.error.8
+  (classify-error (mismatch '(a b) '(a b) :test-not #'identity))
+  program-error)
+
+(deftest mismatch.error.9
+  (classify-error (mismatch '(a b) '(a b) :key #'car))
+  type-error)
+
+(deftest mismatch.error.10
+  (classify-error (mismatch '(a b) '(a b) :key #'cons))
+  program-error)
diff --git a/ansi-tests/notany.lsp b/ansi-tests/notany.lsp
index 4a578f6c..66491af6 100644
--- a/ansi-tests/notany.lsp
+++ b/ansi-tests/notany.lsp
@@ -128,3 +128,15 @@
 (deftest notany.error.10
   (classify-error (locally (notany 1 '(a b c)) t))
   type-error)
+
+(deftest notany.error.11
+  (classify-error (notany #'cons '(a b c)))
+  program-error)
+
+(deftest notany.error.12
+  (classify-error (notany #'cons '(a b c) '(1 2 4) '(g h j)))
+  program-error)
+
+(deftest notany.error.13
+  (classify-error (notany #'car '(a b c)))
+  type-error)
\ No newline at end of file
diff --git a/ansi-tests/notevery.lsp b/ansi-tests/notevery.lsp
index 1b17d58d..35ddba15 100644
--- a/ansi-tests/notevery.lsp
+++ b/ansi-tests/notevery.lsp
@@ -124,3 +124,19 @@
 (deftest notevery.error.9
   (classify-error (notevery #'null))
   program-error)
+
+(deftest notevery.error.10
+  (classify-error (locally (notevery 1 '(a b c)) t))
+  type-error)
+
+(deftest notevery.error.11
+  (classify-error (notevery #'cons '(a b c)))
+  program-error)
+
+(deftest notevery.error.12
+  (classify-error (notevery #'cons '(a b c) '(1 2 4) '(g h j)))
+  program-error)
+
+(deftest notevery.error.13
+  (classify-error (notevery #'car '(a b c)))
+  type-error)
\ No newline at end of file
diff --git a/ansi-tests/nsubstitute-if-not.lsp b/ansi-tests/nsubstitute-if-not.lsp
index 59ae27a7..78528a3c 100644
--- a/ansi-tests/nsubstitute-if-not.lsp
+++ b/ansi-tests/nsubstitute-if-not.lsp
@@ -741,3 +741,21 @@
   (classify-error (nsubstitute-if-not 'a #'null nil 1 2))
   program-error)
 
+(deftest nsubstitute-if-not.error.8
+  (classify-error (nsubstitute-if-not 'a #'cons (list 'a 'b 'c)))
+  program-error)
+
+(deftest nsubstitute-if-not.error.9
+  (classify-error (nsubstitute-if-not 'a #'car (list 'a 'b 'c)))
+  type-error)
+
+(deftest nsubstitute-if-not.error.10
+  (classify-error (nsubstitute-if-not 'a #'identity (list 'a 'b 'c)
+				  :key #'car))
+  type-error)
+
+(deftest nsubstitute-if-not.error.11
+  (classify-error (nsubstitute-if-not 'a #'identity (list 'a 'b 'c)
+				  :key #'cons))
+  program-error)
+
diff --git a/ansi-tests/nsubstitute-if.lsp b/ansi-tests/nsubstitute-if.lsp
index ec034ad4..91f7ade6 100644
--- a/ansi-tests/nsubstitute-if.lsp
+++ b/ansi-tests/nsubstitute-if.lsp
@@ -732,3 +732,22 @@
 (deftest nsubstitute-if.error.7
   (classify-error (nsubstitute-if 'a #'null nil 1 2))
   program-error)
+
+(deftest nsubstitute-if.error.8
+  (classify-error (nsubstitute-if 'a #'cons (list 'a 'b 'c)))
+  program-error)
+
+(deftest nsubstitute-if.error.9
+  (classify-error (nsubstitute-if 'a #'car (list 'a 'b 'c)))
+  type-error)
+
+(deftest nsubstitute-if.error.10
+  (classify-error (nsubstitute-if 'a #'identity (list 'a 'b 'c)
+				  :key #'car))
+  type-error)
+
+(deftest nsubstitute-if.error.11
+  (classify-error (nsubstitute-if 'a #'identity (list 'a 'b 'c)
+				  :key #'cons))
+  program-error)
+
diff --git a/ansi-tests/nsubstitute.lsp b/ansi-tests/nsubstitute.lsp
index fab052ab..ea6a6b0d 100644
--- a/ansi-tests/nsubstitute.lsp
+++ b/ansi-tests/nsubstitute.lsp
@@ -938,3 +938,20 @@
 (deftest nsubstitute.error.7
   (classify-error (nsubstitute 'a 'b nil 1 2))
   program-error)
+
+(deftest nsubstitute.error.8
+  (classify-error (nsubstitute 'a 'b (list 'a 'b 'c) :test #'identity))
+  program-error)
+
+(deftest nsubstitute.error.9
+  (classify-error (nsubstitute 'a 'b (list 'a 'b 'c) :test-not #'identity))
+  program-error)
+
+(deftest nsubstitute.error.10
+  (classify-error (nsubstitute 'a 'b (list 'a 'b 'c) :key #'cons))
+  program-error)
+
+(deftest nsubstitute.error.11
+  (classify-error (nsubstitute 'a 'b (list 'a 'b 'c) :key #'car))
+  type-error)
+
diff --git a/ansi-tests/position-if-not.lsp b/ansi-tests/position-if-not.lsp
index e44ab6a6..00b1d7de 100644
--- a/ansi-tests/position-if-not.lsp
+++ b/ansi-tests/position-if-not.lsp
@@ -557,3 +557,19 @@
 (deftest position-if-not.error.11
   (classify-error (locally (position-if-not #'identity 'b) t))
   type-error)
+
+(deftest position-if-not.error.12
+  (classify-error (position-if-not #'cons '(a b c d)))
+  program-error)
+
+(deftest position-if-not.error.13
+  (classify-error (position-if-not #'car '(a b c d)))
+  type-error)
+
+(deftest position-if-not.error.14
+  (classify-error (position-if-not #'identity '(a b c d) :key #'cdr))
+  type-error)
+
+(deftest position-if-not.error.15
+  (classify-error (position-if-not #'identity '(a b c d) :key #'cons))
+  program-error)
diff --git a/ansi-tests/position-if.lsp b/ansi-tests/position-if.lsp
index 4d590f61..cad0748d 100644
--- a/ansi-tests/position-if.lsp
+++ b/ansi-tests/position-if.lsp
@@ -207,7 +207,7 @@
    (7 7)
    (nil)))
 
-(deftest position-if-vector.11
+(deftest position-if-vector.13
   (let ((a (make-array '(10) :initial-contents '(1 3 1 4 3 1 2 1 8 9)
 		       :fill-pointer 5)))
     (flet ((%f (x) (eql x 1)))
@@ -554,3 +554,21 @@
 (deftest position-if.error.11
   (classify-error (locally (position-if #'identity 'b) t))
   type-error)
+
+(deftest position-if.error.12
+  (classify-error (position-if #'cons '(a b c d)))
+  program-error)
+
+(deftest position-if.error.13
+  (classify-error (position-if #'car '(a b c d)))
+  type-error)
+
+(deftest position-if.error.14
+  (classify-error (position-if #'identity '(a b c d) :key #'cdr))
+  type-error)
+
+(deftest position-if.error.15
+  (classify-error (position-if #'identity '(a b c d) :key #'cons))
+  program-error)
+
+
diff --git a/ansi-tests/position.lsp b/ansi-tests/position.lsp
index f206c2f3..e070b909 100644
--- a/ansi-tests/position.lsp
+++ b/ansi-tests/position.lsp
@@ -754,3 +754,20 @@
 (deftest position.error.11
   (classify-error (locally (position 'a 'b) t))
   type-error)
+
+(deftest position.error.12
+  (classify-error (position 'b '(a b c d) :test #'identity))
+  program-error)
+
+(deftest position.error.13
+  (classify-error (position 'b '(a b c d) :test-not #'not))
+  program-error)
+
+(deftest position.error.14
+  (classify-error (position 'b '(a b c d) :key #'cdr))
+  type-error)
+
+(deftest position.error.15
+  (classify-error (position 'b '(a b c d) :key #'cons))
+  program-error)
+
diff --git a/ansi-tests/reduce.lsp b/ansi-tests/reduce.lsp
index d0a2a0b8..cb74c38e 100644
--- a/ansi-tests/reduce.lsp
+++ b/ansi-tests/reduce.lsp
@@ -196,6 +196,19 @@
   (classify-error (locally (reduce 'cons 'a) t))
   type-error)
 
+(deftest reduce.error.8
+  (classify-error (reduce #'identity '(a b c)))
+  program-error)
+
+(deftest reduce.error.9
+  (classify-error (reduce #'cons '(a b c) :key #'cons))
+  program-error)
+
+(deftest reduce.error.10
+  (classify-error (reduce #'cons '(a b c) :key #'car))
+  type-error)
+
+
 ;;;;;;;;
 
 (deftest reduce-string.1
diff --git a/ansi-tests/remove-duplicates.lsp b/ansi-tests/remove-duplicates.lsp
index e75653e6..ac5956b9 100644
--- a/ansi-tests/remove-duplicates.lsp
+++ b/ansi-tests/remove-duplicates.lsp
@@ -198,6 +198,24 @@
   (classify-error (remove-duplicates nil 1 2))
   program-error)
 
+(deftest remove-duplicates.error.6
+  (classify-error (remove-duplicates (list 'a 'b 'c) :test #'identity))
+  program-error)
+
+(deftest remove-duplicates.error.7
+  (classify-error (remove-duplicates (list 'a 'b 'c) :test-not #'identity))
+  program-error)
+
+(deftest remove-duplicates.error.8
+  (classify-error (remove-duplicates (list 'a 'b 'c) :key #'cons))
+  program-error)
+
+(deftest remove-duplicates.error.9
+  (classify-error (remove-duplicates (list 'a 'b 'c) :key #'car))
+  type-error)
+
+;;;
+
 (deftest delete-duplicates.error.1
   (classify-error (delete-duplicates))
   program-error)
@@ -218,8 +236,18 @@
   (classify-error (delete-duplicates nil 1 2))
   program-error)
 
+(deftest delete-duplicates.error.6
+  (classify-error (delete-duplicates (list 'a 'b 'c) :test #'identity))
+  program-error)
 
+(deftest delete-duplicates.error.7
+  (classify-error (delete-duplicates (list 'a 'b 'c) :test-not #'identity))
+  program-error)
 
+(deftest delete-duplicates.error.8
+  (classify-error (delete-duplicates (list 'a 'b 'c) :key #'cons))
+  program-error)
 
-
-
+(deftest delete-duplicates.error.9
+  (classify-error (delete-duplicates (list 'a 'b 'c) :key #'car))
+  type-error)
\ No newline at end of file
diff --git a/ansi-tests/remove.lsp b/ansi-tests/remove.lsp
index 38fbdd44..ecb01279 100644
--- a/ansi-tests/remove.lsp
+++ b/ansi-tests/remove.lsp
@@ -746,6 +746,25 @@
   (classify-error (remove 'a nil 1 2))
   program-error)
 
+(deftest remove.error.7
+  (classify-error (remove 'a (list 'a 'b 'c) :test #'identity))
+  program-error)
+
+(deftest remove.error.8
+  (classify-error (remove 'a (list 'a 'b 'c) :test-not #'identity))
+  program-error)
+
+(deftest remove.error.9
+  (classify-error (remove 'a (list 'a 'b 'c) :key #'cons))
+  program-error)
+
+(deftest remove.error.10
+  (classify-error (remove 'a (list 'a 'b 'c) :key #'car))
+  type-error)
+
+
+;;;
+
 (deftest delete.error.1
   (classify-error (delete))
   program-error)
@@ -770,3 +789,18 @@
   (classify-error (delete 'a nil 1 2))
   program-error)
 
+(deftest delete.error.7
+  (classify-error (delete 'a (list 'a 'b 'c) :test #'identity))
+  program-error)
+
+(deftest delete.error.8
+  (classify-error (delete 'a (list 'a 'b 'c) :test-not #'identity))
+  program-error)
+
+(deftest delete.error.9
+  (classify-error (delete 'a (list 'a 'b 'c) :key #'cons))
+  program-error)
+
+(deftest delete.error.10
+  (classify-error (delete 'a (list 'a 'b 'c) :key #'car))
+  type-error)
diff --git a/ansi-tests/search-list.lsp b/ansi-tests/search-list.lsp
index 9f810642..5dba4fcd 100644
--- a/ansi-tests/search-list.lsp
+++ b/ansi-tests/search-list.lsp
@@ -198,6 +198,22 @@
   (classify-error (search "a" "a" 1 2))
   program-error)
 
+(deftest search.error.7
+  (classify-error (search "c" "abcde" :test #'identity))
+  program-error)
+
+(deftest search.error.8
+  (classify-error (search "c" "abcde" :test-not #'identity))
+  program-error)
+
+(deftest search.error.9
+  (classify-error (search "c" "abcde" :key #'cons))
+  program-error)
+
+(deftest search.error.10
+  (classify-error (search "c" "abcde" :key #'car))
+  type-error)
+
 ;;; Order of evaluation
 
 (deftest search.order.1
diff --git a/ansi-tests/some.lsp b/ansi-tests/some.lsp
index d1a7517a..59323757 100644
--- a/ansi-tests/some.lsp
+++ b/ansi-tests/some.lsp
@@ -135,3 +135,17 @@
 (deftest some.error.10
   (classify-error (locally (some 1 '(a b c)) t))
   type-error)
+
+(deftest some.error.11
+  (classify-error (some #'cons '(a b c)))
+  program-error)
+
+(deftest some.error.12
+  (classify-error (some #'car '(a b c)))
+  type-error)
+
+(deftest some.error.13
+  (classify-error (some #'cons '(a b c) '(b c d) '(c d e)))
+  program-error)
+
+
diff --git a/ansi-tests/sort.lsp b/ansi-tests/sort.lsp
index f4d7fb10..1eabcac7 100644
--- a/ansi-tests/sort.lsp
+++ b/ansi-tests/sort.lsp
@@ -125,3 +125,19 @@
 (deftest sort.error.6
   (classify-error (sort nil #'< 1 2))
   program-error)
+
+(deftest sort.error.7
+  (classify-error (sort (list 1 2 3 4) #'identity))
+  program-error)
+
+(deftest sort.error.8
+  (classify-error (sort (list 1 2 3 4) #'< :key #'cons))
+  program-error)
+
+(deftest sort.error.9
+  (classify-error (sort (list 1 2 3 4) #'< :key #'car))
+  type-error)
+
+(deftest sort.error.10
+  (classify-error (sort (list 1 2 3 4) #'elt))
+  type-error)
diff --git a/ansi-tests/stable-sort.lsp b/ansi-tests/stable-sort.lsp
index cbf79d84..9925d9cb 100644
--- a/ansi-tests/stable-sort.lsp
+++ b/ansi-tests/stable-sort.lsp
@@ -135,4 +135,20 @@
 
 (deftest stable-sort.error.6
   (classify-error (stable-sort nil #'< 1 2))
-  program-error)
\ No newline at end of file
+  program-error)
+
+(deftest stable-sort.error.7
+  (classify-error (stable-sort (list 1 2 3 4) #'identity))
+  program-error)
+
+(deftest stable-sort.error.8
+  (classify-error (stable-sort (list 1 2 3 4) #'< :key #'cons))
+  program-error)
+
+(deftest stable-sort.error.9
+  (classify-error (stable-sort (list 1 2 3 4) #'< :key #'car))
+  type-error)
+
+(deftest stable-sort.error.10
+  (classify-error (stable-sort (list 1 2 3 4) #'elt))
+  type-error)
diff --git a/ansi-tests/substitute-if-not.lsp b/ansi-tests/substitute-if-not.lsp
index 26b5b578..ad57f65f 100644
--- a/ansi-tests/substitute-if-not.lsp
+++ b/ansi-tests/substitute-if-not.lsp
@@ -816,3 +816,22 @@
 (deftest substitute-if-not.error.7
   (classify-error (substitute-if-not 'a #'null nil 1 2))
   program-error)
+
+(deftest substitute-if-not.error.8
+  (classify-error (substitute-if-not 'a #'cons (list 'a 'b 'c)))
+  program-error)
+
+(deftest substitute-if-not.error.9
+  (classify-error (substitute-if-not 'a #'car (list 'a 'b 'c)))
+  type-error)
+
+(deftest substitute-if-not.error.10
+  (classify-error (substitute-if-not 'a #'identity (list 'a 'b 'c)
+				  :key #'car))
+  type-error)
+
+(deftest substitute-if-not.error.11
+  (classify-error (substitute-if-not 'a #'identity (list 'a 'b 'c)
+				  :key #'cons))
+  program-error)
+
diff --git a/ansi-tests/substitute-if.lsp b/ansi-tests/substitute-if.lsp
index 7dfac780..2643cc29 100644
--- a/ansi-tests/substitute-if.lsp
+++ b/ansi-tests/substitute-if.lsp
@@ -836,3 +836,21 @@
 (deftest substitute-if.error.7
   (classify-error (substitute-if 'a #'null nil 1 2))
   program-error)
+
+(deftest substitute-if.error.8
+  (classify-error (substitute-if 'a #'cons (list 'a 'b 'c)))
+  program-error)
+
+(deftest substitute-if.error.9
+  (classify-error (substitute-if 'a #'car (list 'a 'b 'c)))
+  type-error)
+
+(deftest substitute-if.error.10
+  (classify-error (substitute-if 'a #'identity (list 'a 'b 'c)
+				  :key #'car))
+  type-error)
+
+(deftest substitute-if.error.11
+  (classify-error (substitute-if 'a #'identity (list 'a 'b 'c)
+				  :key #'cons))
+  program-error)
diff --git a/ansi-tests/substitute.lsp b/ansi-tests/substitute.lsp
index 3ec0ed2c..bd17f8e5 100644
--- a/ansi-tests/substitute.lsp
+++ b/ansi-tests/substitute.lsp
@@ -1067,3 +1067,20 @@
 (deftest substitute.error.7
   (classify-error (substitute 'a 'b nil 1 2))
   program-error)
+
+(deftest substitute.error.8
+  (classify-error (substitute 'a 'b (list 'a 'b 'c) :test #'identity))
+  program-error)
+
+(deftest substitute.error.9
+  (classify-error (substitute 'a 'b (list 'a 'b 'c) :test-not #'identity))
+  program-error)
+
+(deftest substitute.error.10
+  (classify-error (substitute 'a 'b (list 'a 'b 'c) :key #'cons))
+  program-error)
+
+(deftest substitute.error.11
+  (classify-error (substitute 'a 'b (list 'a 'b 'c) :key #'car))
+  type-error)
+
-- 
GitLab