diff --git a/ansi-tests/cons-test-02.lsp b/ansi-tests/cons-test-02.lsp index 82984ecf07bf0487dc6923f7a656d789dfdac456..194d41d659082983108011f9a26979cad75e4de2 100644 --- a/ansi-tests/cons-test-02.lsp +++ b/ansi-tests/cons-test-02.lsp @@ -95,10 +95,34 @@ :key nil) (2 2 b b)) -(deftest sublis-9 - (sublis nil 'a :bad-keyword t :allow-other-keys t) +;;; Keyword tests + +(deftest sublis.allow-other-keys.1 + (sublis nil 'a :bad t :allow-other-keys t) + a) + +(deftest sublis.allow-other-keys.2 + (sublis nil 'a :allow-other-keys t :bad t) + a) + +(deftest sublis.allow-other-keys.3 + (sublis nil 'a :allow-other-keys t) + a) + +(deftest sublis.allow-other-keys.4 + (sublis nil 'a :allow-other-keys nil) a) +(deftest sublis.allow-other-keys.5 + (sublis nil 'a :allow-other-keys t :allow-other-keys t :bad t) + a) + +(deftest sublis.keywords.6 + (sublis '((1 . a)) (list 0 1 2) :key #'(lambda (x) (if (numberp x) (1+ x) x)) + :key #'identity) + (a 1 2)) + + ;; Argument error cases (deftest sublis.error.1 @@ -181,6 +205,34 @@ :key nil) (2 2 b b)) +;;; Keyword tests + +(deftest nsublis.allow-other-keys.1 + (nsublis nil 'a :bad t :allow-other-keys t) + a) + +(deftest nsublis.allow-other-keys.2 + (nsublis nil 'a :allow-other-keys t :bad t) + a) + +(deftest nsublis.allow-other-keys.3 + (nsublis nil 'a :allow-other-keys t) + a) + +(deftest nsublis.allow-other-keys.4 + (nsublis nil 'a :allow-other-keys nil) + a) + +(deftest nsublis.allow-other-keys.5 + (nsublis nil 'a :allow-other-keys t :allow-other-keys t :bad t) + a) + +(deftest nsublis.keywords.6 + (nsublis '((1 . a)) (list 0 1 2) + :key #'(lambda (x) (if (numberp x) (1+ x) x)) + :key #'identity) + (a 1 2)) + ;; Argument error cases (deftest nsublis.error.1 @@ -262,9 +314,35 @@ :key nil) (a a c d a a)) -(deftest subst-10 - (subst 'a 'b nil :bad t :allow-other-keys t) - nil) +;;; Keyword tests for subst + +(deftest subst.allow-other-keys.1 + (subst 'a 'b (list 'a 'b 'c) :bad t :allow-other-keys t) + (a a c)) + +(deftest subst.allow-other-keys.2 + (subst 'a 'b (list 'a 'b 'c) :allow-other-keys t) + (a a c)) + +(deftest subst.allow-other-keys.3 + (subst 'a 'b (list 'a 'b 'c) :allow-other-keys nil) + (a a c)) + +(deftest subst.allow-other-keys.4 + (subst 'a 'b (list 'a 'b 'c) :allow-other-keys t :bad t) + (a a c)) + +(deftest subst.allow-other-keys.5 + (subst 'a 'b (list 'a 'b 'c) :allow-other-keys t :allow-other-keys nil + :bad t) + (a a c)) + +(deftest subst.keywords.6 + (subst 'a 'b (list 'a 'b 'c) :test #'eq :test (complement #'eq)) + (a a c)) + + +;;; Tests for subst-if, subst-if-not (deftest subst-if-1 (check-subst-if 'a #'consp '((100 1) (2 3) (4 3 2 1) (a b c))) @@ -332,20 +410,63 @@ :key nil) ((a) (a) (c) (d))) -(deftest subst-if-7 - (subst-if 'a #'null nil :bad t :allow-other-keys t) - a) - (deftest subst-if-not-5 (check-subst-if-not 'a #'(lambda (x) (not (eql x 'b))) '((a) (b) (c) (d)) :key nil) ((a) (a) (c) (d))) -(deftest subst-if-not-7 - (subst-if 'a #'identity nil :bad t :allow-other-keys t) - nil) +;;; Keyword tests for subst-if + +(deftest subst-if.allow-other-keys.1 + (subst-if 'a #'null nil :bad t :allow-other-keys t) + a) + +(deftest subst-if.allow-other-keys.2 + (subst-if 'a #'null nil :allow-other-keys t) + a) + +(deftest subst-if.allow-other-keys.3 + (subst-if 'a #'null nil :allow-other-keys nil) + a) + +(deftest subst-if.allow-other-keys.4 + (subst-if 'a #'null nil :allow-other-keys t :bad t) + a) + +(deftest subst-if.allow-other-keys.5 + (subst-if 'a #'null nil :allow-other-keys t :allow-other-keys nil :bad t) + a) + +(deftest subst-if.keywords.6 + (subst-if 'a #'null nil :key nil :key (constantly 'b)) + a) +;;; Keywords tests for subst-if-not + +(deftest subst-if-not.allow-other-keys.1 + (subst-if-not 'a #'identity nil :bad t :allow-other-keys t) + a) + +(deftest subst-if-not.allow-other-keys.2 + (subst-if-not 'a #'identity nil :allow-other-keys t) + a) + +(deftest subst-if-not.allow-other-keys.3 + (subst-if-not 'a #'identity nil :allow-other-keys nil) + a) + +(deftest subst-if-not.allow-other-keys.4 + (subst-if-not 'a #'identity nil :allow-other-keys t :bad t) + a) + +(deftest subst-if-not.allow-other-keys.5 + (subst-if-not 'a #'identity nil :allow-other-keys t :allow-other-keys nil :bad t) + a) + +(deftest subst-if-not.keywords.6 + (subst-if-not 'a #'identity nil :key nil :key (constantly 'b)) + a) (defvar *nsubst-tree-1* '(10 (30 20 10) (20 10) (10 20 30 40))) @@ -404,10 +525,35 @@ :key nil) (a a c d a a)) -(deftest nsubst-10 - (nsubst 'a 'b nil :bad t :allow-other-keys t) - nil) - +;;; Keyword tests for nsubst + +(deftest nsubst.allow-other-keys.1 + (nsubst 'a 'b (list 'a 'b 'c) :bad t :allow-other-keys t) + (a a c)) + +(deftest nsubst.allow-other-keys.2 + (nsubst 'a 'b (list 'a 'b 'c) :allow-other-keys t) + (a a c)) + +(deftest nsubst.allow-other-keys.3 + (nsubst 'a 'b (list 'a 'b 'c) :allow-other-keys nil) + (a a c)) + +(deftest nsubst.allow-other-keys.4 + (nsubst 'a 'b (list 'a 'b 'c) :allow-other-keys t :bad t) + (a a c)) + +(deftest nsubst.allow-other-keys.5 + (nsubst 'a 'b (list 'a 'b 'c) :allow-other-keys t :allow-other-keys nil + :bad t) + (a a c)) + +(deftest nsubst.keywords.6 + (nsubst 'a 'b (list 'a 'b 'c) :test #'eq :test (complement #'eq)) + (a a c)) + +;;; Tests for nsubst-if, nsubst-if-not + (deftest nsubst-if-1 (check-nsubst-if 'a #'consp '((100 1) (2 3) (4 3 2 1) (a b c))) A) @@ -488,6 +634,58 @@ (nsubst-if-not 'a #'null nil :bad t :allow-other-keys t) nil) +;;; Keyword tests for nsubst-if + +(deftest nsubst-if.allow-other-keys.1 + (nsubst-if 'a #'null nil :bad t :allow-other-keys t) + a) + +(deftest nsubst-if.allow-other-keys.2 + (nsubst-if 'a #'null nil :allow-other-keys t) + a) + +(deftest nsubst-if.allow-other-keys.3 + (nsubst-if 'a #'null nil :allow-other-keys nil) + a) + +(deftest nsubst-if.allow-other-keys.4 + (nsubst-if 'a #'null nil :allow-other-keys t :bad t) + a) + +(deftest nsubst-if.allow-other-keys.5 + (nsubst-if 'a #'null nil :allow-other-keys t :allow-other-keys nil :bad t) + a) + +(deftest nsubst-if.keywords.6 + (nsubst-if 'a #'null nil :key nil :key (constantly 'b)) + a) + +;;; Keywords tests for nsubst-if-not + +(deftest nsubst-if-not.allow-other-keys.1 + (nsubst-if-not 'a #'identity nil :bad t :allow-other-keys t) + a) + +(deftest nsubst-if-not.allow-other-keys.2 + (nsubst-if-not 'a #'identity nil :allow-other-keys t) + a) + +(deftest nsubst-if-not.allow-other-keys.3 + (nsubst-if-not 'a #'identity nil :allow-other-keys nil) + a) + +(deftest nsubst-if-not.allow-other-keys.4 + (nsubst-if-not 'a #'identity nil :allow-other-keys t :bad t) + a) + +(deftest nsubst-if-not.allow-other-keys.5 + (nsubst-if-not 'a #'identity nil :allow-other-keys t :allow-other-keys nil :bad t) + a) + +(deftest nsubst-if-not.keywords.6 + (nsubst-if-not 'a #'identity nil :key nil :key (constantly 'b)) + a) + ;;; Error cases ;;; subst diff --git a/ansi-tests/cons-test-03.lsp b/ansi-tests/cons-test-03.lsp index 6232e2bcc13112245bd79596dc4d42c87223d479..751eac89b2ea01541ad2acf3d660dd0490c8f2f0 100644 --- a/ansi-tests/cons-test-03.lsp +++ b/ansi-tests/cons-test-03.lsp @@ -189,14 +189,26 @@ (make-list 6 :initial-element 'a) (a a a a a a)) -(deftest make-list-other-keywords.1 +(deftest make-list.allow-other-keys.1 (make-list 5 :allow-other-keys t :foo 'a) (nil nil nil nil nil)) -(deftest make-list-other-keywords.2 +(deftest make-list.allow-other-keys.2 (make-list 5 :bar nil :allow-other-keys t) (nil nil nil nil nil)) +(deftest make-list.allow-other-keys.3 + (make-list 5 :allow-other-keys nil) + (nil nil nil nil nil)) + +(deftest make-list.allow-other-keys.4 + (make-list 5 :allow-other-keys t :allow-other-keys nil 'bad t) + (nil nil nil nil nil)) + +(deftest make-list.allow-other-keys.5 + (make-list 5 :allow-other-keys t) + (nil nil nil nil nil)) + (deftest make-list-repeated-keyword (make-list 5 :initial-element 'a :initial-element 'b) (a a a a a)) diff --git a/ansi-tests/cons-test-04.lsp b/ansi-tests/cons-test-04.lsp index 7f1ca4bc584b06fa05d436992a4a51577d2c78c2..f1bffa9cfcf11e910814b2d97c93e84fd79771c1 100644 --- a/ansi-tests/cons-test-04.lsp +++ b/ansi-tests/cons-test-04.lsp @@ -258,14 +258,26 @@ :test-not (complement #'equal) :key nil) (aaa "AAA" "aaa" #\a)) -(deftest adjoin-other-keys-1 +(deftest adjoin.allow-other-keys.1 (adjoin 'a '(b c) :bad t :allow-other-keys t) (a b c)) -(deftest adjoin-other-keys-2 +(deftest adjoin.allow-other-keys.2 (adjoin 'a '(b c) :allow-other-keys t :foo t) (a b c)) +(deftest adjoin.allow-other-keys.3 + (adjoin 'a '(b c) :allow-other-keys t) + (a b c)) + +(deftest adjoin.allow-other-keys.4 + (adjoin 'a '(b c) :allow-other-keys nil) + (a b c)) + +(deftest adjoin.allow-other-keys.5 + (adjoin 'a '(b c) :allow-other-keys t :allow-other-keys nil 'bad t) + (a b c)) + (deftest adjoin-repeat-key (adjoin 'a '(b c) :test #'eq :test (complement #'eq)) (a b c)) diff --git a/ansi-tests/cons-test-13.lsp b/ansi-tests/cons-test-13.lsp index f3987a8bf90bbe2fbbf9b43b05b87ed56a190c82..afe1a3366a4136f7fae8e31853922129406e98c0 100644 --- a/ansi-tests/cons-test-13.lsp +++ b/ansi-tests/cons-test-13.lsp @@ -143,11 +143,29 @@ (member 'z '(a b c d) :key nil) nil) -(deftest member-20 +;;; Keyword tests + +(deftest member.allow-other-keys.1 (member 'b '(a b c) :bad t :allow-other-keys t) (b c)) -(deftest member-21 +(deftest member.allow-other-keys.2 + (member 'b '(a b c) :allow-other-keys t :bad t) + (b c)) + +(deftest member.allow-other-keys.3 + (member 'b '(a b c) :allow-other-keys t) + (b c)) + +(deftest member.allow-other-keys.4 + (member 'b '(a b c) :allow-other-keys nil) + (b c)) + +(deftest member.allow-other-keys.5 + (member 'b '(a b c) :allow-other-keys 17 :allow-other-keys nil '#:x t) + (b c)) + +(deftest member.keywords.6 (member 'b '(a b c) :test #'eq :test (complement #'eq)) (b c)) diff --git a/ansi-tests/cons-test-14.lsp b/ansi-tests/cons-test-14.lsp index 9994c6c2f3f3a1dcd73a7577ffae6e99b09cb9e6..e422f97104d9255184285b6c297108dc299bc48b 100644 --- a/ansi-tests/cons-test-14.lsp +++ b/ansi-tests/cons-test-14.lsp @@ -43,18 +43,37 @@ (member-if #'identity '(1 2 3 4 5) :key #'evenp) (2 3 4 5)) -(deftest member-if-6 +;;; Keyword tests + +(deftest member-if.keywords.1 (member-if #'identity '(1 2 3 4 5) :key #'evenp :key #'oddp) (2 3 4 5)) -(deftest member-if-7 +(deftest member-if.allow-other-keys.2 (member-if #'identity '(nil 2 3 4 5) :allow-other-keys t :bad t) (2 3 4 5)) -(deftest member-if-8 +(deftest member-if.allow-other-keys.3 (member-if #'identity '(nil 2 3 4 5) :bad t :allow-other-keys t) (2 3 4 5)) +(deftest member-if.allow-other-keys.4 + (member-if #'identity '(nil 2 3 4 5) :allow-other-keys t) + (2 3 4 5)) + +(deftest member-if.allow-other-keys.5 + (member-if #'identity '(nil 2 3 4 5) :allow-other-keys nil) + (2 3 4 5)) + +(deftest member-if.allow-other-keys.5 + (member-if #'identity '(nil 2 3 4 5) :allow-other-keys t + :allow-other-keys nil) + (2 3 4 5)) + +(deftest member-if.allow-other-keys.6 + (member-if #'identity '(nil 2 3 4 5) :allow-other-keys t + :allow-other-keys nil :key #'identity :key #'null) + (2 3 4 5)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; member-if-not @@ -92,18 +111,34 @@ (member-if-not #'not '(1 2 3 4 5) :key #'evenp) (2 3 4 5)) -(deftest member-if-not-6 +;;; Keyword tests + +(deftest member-if-not.keywords.1 (member-if-not #'not '(1 2 3 4 5) :key #'evenp :key #'oddp) (2 3 4 5)) -(deftest member-if-not-7 +(deftest member-if-not.allow-other-keys.2 (member-if-not #'not '(nil 2 3 4 5) :allow-other-keys t :bad t) (2 3 4 5)) -(deftest member-if-not-8 +(deftest member-if-not.allow-other-keys.3 (member-if-not #'not '(nil 2 3 4 5) :bad t :allow-other-keys t) (2 3 4 5)) +(deftest member-if-not.allow-other-keys.4 + (member-if-not #'not '(nil 2 3 4 5) :allow-other-keys t) + (2 3 4 5)) + +(deftest member-if-not.allow-other-keys.5 + (member-if-not #'not '(nil 2 3 4 5) :allow-other-keys nil) + (2 3 4 5)) + +(deftest member-if-not.allow-other-keys.6 + (member-if-not #'not '(nil 2 3 4 5) :allow-other-keys t + :allow-other-keys nil :key #'identity :key #'null) + (2 3 4 5)) + + ;;; Error cases (deftest member-if.error.1 diff --git a/ansi-tests/cons-test-16.lsp b/ansi-tests/cons-test-16.lsp index 9f1cb86b4e50bfc9817e62ec32c6e1f3400052a1..fa00acb0c5ab120ef29dbea02f9ceed750331efd 100644 --- a/ansi-tests/cons-test-16.lsp +++ b/ansi-tests/cons-test-16.lsp @@ -194,19 +194,38 @@ (eqt x y)))) (A . 3)) -(deftest assoc-26 +;;; Keyword tests + +(deftest assoc.allow-other-keys.1 (assoc 'b '((a . 1) (b . 2) (c . 3)) :bad t :allow-other-keys t) (b . 2)) -(deftest assoc-27 +(deftest assoc.allow-other-keys.2 (assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys t :also-bad t) (b . 2)) -(deftest assoc-28 +(deftest assoc.allow-other-keys.3 (assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys t :also-bad t :test-not #'eql) (a . 1)) +(deftest assoc.allow-other-keys.4 + (assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys t) + (b . 2)) + +(deftest assoc.allow-other-keys.5 + (assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys nil) + (b . 2)) + +(deftest assoc.keywords.6 + (assoc 'b '((a . 1) (b . 2) (c . 3)) :key #'identity :key #'null) + (b . 2)) + +(deftest assoc.keywords.7 + (assoc 'b '((a . 1) (b . 2) (c . 3)) :key nil :key #'null) + (b . 2)) + + (deftest assoc.error.1 (classify-error (assoc)) program-error) @@ -268,20 +287,38 @@ (assoc-if #'null '((a . b) nil (c . d) (nil . e) (f . g))) (nil . e)) -(deftest assoc-if-5 +;;; Keyword tests + +(deftest assoc-if.allow-other-keys.1 (assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :bad t :allow-other-keys t) (nil . 2)) -(deftest assoc-if-6 +(deftest assoc-if.allow-other-keys.2 (assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :allow-other-keys t :also-bad t) (nil . 2)) -(deftest assoc-if-7 +(deftest assoc-if.allow-other-keys.3 (assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :allow-other-keys t :also-bad t :key #'not) (a . 1)) +(deftest assoc-if.allow-other-keys.4 + (assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :allow-other-keys t) + (nil . 2)) + +(deftest assoc-if.allow-other-keys.5 + (assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :allow-other-keys nil) + (nil . 2)) + +(deftest assoc-if.keywords.6 + (assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :key #'identity :key #'null) + (nil . 2)) + +(deftest assoc-if.keywords.7 + (assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :key nil :key #'null) + (nil . 2)) + ;;; Error cases (deftest assoc-if.error.1 @@ -345,21 +382,42 @@ (assoc-if-not #'identity '((a . b) nil (c . d) (nil . e) (f . g))) (nil . e)) -(deftest assoc-if-not-5 +;;; Keyword tests + +(deftest assoc-if-not.allow-other-keys.1 (assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :bad t :allow-other-keys t) (nil . 2)) -(deftest assoc-if-not-6 +(deftest assoc-if-not.allow-other-keys.2 (assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :allow-other-keys t :also-bad t) (nil . 2)) -(deftest assoc-if-not-7 +(deftest assoc-if-not.allow-other-keys.3 (assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :allow-other-keys t :also-bad t :key #'not) (a . 1)) +(deftest assoc-if-not.allow-other-keys.4 + (assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :allow-other-keys t) + (nil . 2)) + +(deftest assoc-if-not.allow-other-keys.5 + (assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :allow-other-keys nil) + (nil . 2)) + +(deftest assoc-if-not.keywords.6 + (assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) + :key #'identity :key #'null) + (nil . 2)) + +(deftest assoc-if-not.keywords.7 + (assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :key nil :key #'null) + (nil . 2)) + +;;; Error tests + (deftest assoc-if-not.error.1 (classify-error (assoc-if-not)) program-error) diff --git a/ansi-tests/count-if-not.lsp b/ansi-tests/count-if-not.lsp index 090ec65f846174edfcabf0f981875f09eb010fcd..2459680909d0a69209b3964d2c3bd3d2ea30b217 100644 --- a/ansi-tests/count-if-not.lsp +++ b/ansi-tests/count-if-not.lsp @@ -418,7 +418,7 @@ (count-if-not #'%onep a :from-end t))))) 2 3 2 3) -;;; Allow-other-keys tests +;;; Keyword tests (deftest count-if-not.keywords.1 (count-if-not #'oddp '(1 2 3 4 5) :bad t :allow-other-keys t) diff --git a/ansi-tests/count-if.lsp b/ansi-tests/count-if.lsp index f32e945b6ef33c0b6674552afde02dbf9dc17373..85a2f28a235254b27635bf4bf8f152d9e1f79603 100644 --- a/ansi-tests/count-if.lsp +++ b/ansi-tests/count-if.lsp @@ -417,7 +417,7 @@ (count-if #'digit-char-p s :start 1 :end 2))) 3 3 2 2 1) -;;; Allow-other-keys tests +;;; Keyword tests (deftest count-if.allow-other-keys.1 (count-if #'evenp '(1 2 3 4 5) :bad t :allow-other-keys t) @@ -435,10 +435,13 @@ :bad t) 2) -(deftest count-if.allow-other-keys.4 +(deftest count-if.keywords.4 (count-if #'evenp '(1 2 3 4 5) :key #'identity :key #'1+) 2) +(deftest count-if.allow-other-keys.5 + (count-if #'evenp '(1 2 3 4 5) :allow-other-keys nil) + 2) ;;; Error tests diff --git a/ansi-tests/count.lsp b/ansi-tests/count.lsp index 8456c0595b6a644d2b55f5d0e5233b24135dce56..a60c1fd0311d2ca47a3888b8d6b8ca2ee8ce7bcd 100644 --- a/ansi-tests/count.lsp +++ b/ansi-tests/count.lsp @@ -486,7 +486,7 @@ :start 2 :end 5) 3) -;;; Allow-other-keys tests +;;; Keyword tests (deftest count.allow-other-keys.1 (count 'a '(b a d a c) :bad t :allow-other-keys t) @@ -504,7 +504,7 @@ :bad t) 2) -(deftest count.allow-other-keys.4 +(deftest count.keywords.4 (count 2 '(1 2 3 2 5) :key #'identity :key #'1+) 2) diff --git a/ansi-tests/make-sequence.lsp b/ansi-tests/make-sequence.lsp index 93c341f95a53ac781d2a5635fea6a7aef3bbeea4..4a0249943cd96193111d13132ac948cc855a0097 100644 --- a/ansi-tests/make-sequence.lsp +++ b/ansi-tests/make-sequence.lsp @@ -165,6 +165,33 @@ (equalp (make-sequence 'string 5) (make-string 5)) t) +;;; Keyword tests + +(deftest make-sequence.allow-other-keys.1 + (make-sequence 'list 5 :allow-other-keys t :initial-element 'a :bad t) + (a a a a a)) + +(deftest make-sequence.allow-other-keys.2 + (make-sequence 'list 5 :initial-element 'a :bad t :allow-other-keys t) + (a a a a a)) + +(deftest make-sequence.allow-other-keys.3 + (make-sequence 'list 5 :initial-element 'a :allow-other-keys t) + (a a a a a)) + +(deftest make-sequence.allow-other-keys.4 + (make-sequence 'list 5 :initial-element 'a :allow-other-keys nil) + (a a a a a)) + +(deftest make-sequence.allow-other-keys.5 + (make-sequence 'list 5 :initial-element 'a :allow-other-keys t + :allow-other-keys nil :bad t) + (a a a a a)) + +(deftest make-sequence.keywords.6 + (make-sequence 'list 5 :initial-element 'a :initial-element 'b) + (a a a a a)) + ;;; Tests for errors (deftest make-sequence.error.1 diff --git a/ansi-tests/make-string.lsp b/ansi-tests/make-string.lsp index 65935992a5d450b1e962921f3547dd879480659e..3094cf8b3bc991b8dc227772f81edc768275f1af 100644 --- a/ansi-tests/make-string.lsp +++ b/ansi-tests/make-string.lsp @@ -72,7 +72,41 @@ )) t) -;;; Error cases +;;; Keyword tests +; +(deftest make-string.allow-other-keys.1 + (make-string 5 :allow-other-keys t :initial-element #\a) + "aaaaa") + +(deftest make-string.allow-other-keys.2 + (make-string 5 :initial-element #\a :allow-other-keys t) + "aaaaa") + +(deftest make-string.allow-other-keys.3 + (make-string 5 :initial-element #\a :allow-other-keys t + :bad t) + "aaaaa") + +(deftest make-string.allow-other-keys.4 + (make-string 5 :bad t :allow-other-keys t :allow-other-keys nil + :initial-element #\a) + "aaaaa") + +(deftest make-string.allow-other-keys.5 + (make-string 5 :allow-other-keys t :bad t :allow-other-keys nil + :initial-element #\a) + "aaaaa") + +(deftest make-string.allow-other-keys.6 + (make-string 5 :allow-other-keys t :allow-other-keys nil :bad nil + :initial-element #\a) + "aaaaa") + +(deftest make-string.keywords.7 + (make-string 5 :initial-element #\a :initial-element #\b) + "aaaaa") + +;; Error cases (deftest make-string.error.1 (classify-error (make-string)) diff --git a/ansi-tests/mismatch.lsp b/ansi-tests/mismatch.lsp index 5c8dc51fa4080921a4e679aad1aef1edd2811c87..783b56319681ef148f0e15c6d8601bf59194e1f3 100644 --- a/ansi-tests/mismatch.lsp +++ b/ansi-tests/mismatch.lsp @@ -597,6 +597,40 @@ (mismatch m a :from-end t))) (4 4 5 nil nil 6 5 6)) +;;; Keyword tests + +(deftest mismatch.allow-other-keys.1 + (mismatch "1234" "1244" :allow-other-keys t :bad t) + 2) + +(deftest mismatch.allow-other-keys.2 + (mismatch "1234" "1244" :bad t :allow-other-keys t) + 2) + +(deftest mismatch.allow-other-keys.3 + (mismatch "1234" "1244" :bad t :allow-other-keys t :allow-other-keys nil) + 2) + +(deftest mismatch.allow-other-keys.4 + (mismatch "1234" "1244" :allow-other-keys t :bad t + :allow-other-keys nil) + 2) + +(deftest mismatch.allow-other-keys.5 + (mismatch "1234" "1244" :allow-other-keys t + :allow-other-keys nil + :bad t) + 2) + +(deftest mismatch.keywords.6 + (mismatch "1234" "1244" :test #'equal :test (complement #'equal)) + 2) + +(deftest mismatch.allow-other-keys.7 + (mismatch "1234" "1244" :bad t :allow-other-keys t + :test (complement #'equal)) + 0) + ;;; Error cases (deftest mismatch.error.1 diff --git a/ansi-tests/nsubstitute-if-not.lsp b/ansi-tests/nsubstitute-if-not.lsp index 4fc12e0b60b4954a39bc97462cab3d32ad01e8bf..55953c7d4d783737cd227864895f7ba8e7328c80 100644 --- a/ansi-tests/nsubstitute-if-not.lsp +++ b/ansi-tests/nsubstitute-if-not.lsp @@ -633,6 +633,48 @@ result) #*01111) +;;; Keyword tests + +(deftest nsubstitute-if-not.allow-other-keys.1 + (nsubstitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) + :allow-other-keys t :bad t) + (a a 0 a a 0 a)) + +(deftest nsubstitute-if-not.allow-other-keys.2 + (nsubstitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) + :bad t :allow-other-keys t) + (a a 0 a a 0 a)) + +(deftest nsubstitute-if-not.allow-other-keys.3 + (nsubstitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t + :allow-other-keys nil :bad t) + (a a 0 a a 0 a)) + +(deftest nsubstitute-if-not.allow-other-keys.4 + (nsubstitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) :bad t + :allow-other-keys t :allow-other-keys nil) + (a a 0 a a 0 a)) + +(deftest nsubstitute-if-not.allow-other-keys.5 + (nsubstitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) + :allow-other-keys t :key #'1-) + (1 a a a 1 a a)) + +(deftest nsubstitute-if-not.keywords.6 + (nsubstitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) + :key #'1- :key #'identity) + (1 a a a 1 a a)) + +(deftest nsubstitute-if-not.allow-other-keys.7 + (nsubstitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t + :bad t :allow-other-keys nil) + (a a 0 a a 0 a)) + +(deftest nsubstitute-if-not.allow-other-keys.8 + (nsubstitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys nil) + (a a 0 a a 0 a)) + + ;;; Error cases (deftest nsubstitute-if-not.error.1 diff --git a/ansi-tests/nsubstitute-if.lsp b/ansi-tests/nsubstitute-if.lsp index b6bef91eef8d254d6e1607bdadc08bcda6e99a9f..b7eb74406fb44e8117c8e74d3c8ab2f8d9f20756 100644 --- a/ansi-tests/nsubstitute-if.lsp +++ b/ansi-tests/nsubstitute-if.lsp @@ -630,6 +630,44 @@ result) #*01111) +;;; Keyword tests + +(deftest nsubstitute-if.allow-other-keys.1 + (nsubstitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t :bad t) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute-if.allow-other-keys.2 + (nsubstitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :bad t :allow-other-keys t) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute-if.allow-other-keys.3 + (nsubstitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t + :allow-other-keys nil :bad t) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute-if.allow-other-keys.4 + (nsubstitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :bad t + :allow-other-keys t :allow-other-keys nil) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute-if.allow-other-keys.5 + (nsubstitute-if 'a #'zerop (list 1 2 0 3 1 0 3) + :allow-other-keys t :key #'1-) + (a 2 0 3 a 0 3)) + +(deftest nsubstitute-if.keywords.6 + (nsubstitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :key #'1- :key #'identity) + (a 2 0 3 a 0 3)) + +(deftest nsubstitute-if.allow-other-keys.7 + (nsubstitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t + :bad t :allow-other-keys nil) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute-if.allow-other-keys.8 + (nsubstitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys nil) + (1 2 a 3 1 a 3)) + ;;; Error cases (deftest nsubstitute-if.error.1 diff --git a/ansi-tests/nsubstitute.lsp b/ansi-tests/nsubstitute.lsp index b1d336935c18bb147014ca2b5549e1f27f3672ee..27beb4b49a2ef366665e060dac51e6e9f5b7af39 100644 --- a/ansi-tests/nsubstitute.lsp +++ b/ansi-tests/nsubstitute.lsp @@ -836,6 +836,45 @@ result) #*01111) +;;; Keyword tests + +(deftest nsubstitute.allow-other-keys.1 + (nsubstitute 'a 0 (list 1 2 0 3 1 0 3) :allow-other-keys t :bad t) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute.allow-other-keys.2 + (nsubstitute 'a 0 (list 1 2 0 3 1 0 3) :bad t :allow-other-keys t) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute.allow-other-keys.3 + (nsubstitute 'a 0 (list 1 2 0 3 1 0 3) :allow-other-keys t + :allow-other-keys nil :bad t) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute.allow-other-keys.4 + (nsubstitute 'a 0 (list 1 2 0 3 1 0 3) :bad t + :allow-other-keys t :allow-other-keys nil) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute.allow-other-keys.5 + (nsubstitute 'a 0 (list 1 2 0 3 1 0 3) + :allow-other-keys t :key #'1-) + (a 2 0 3 a 0 3)) + +(deftest nsubstitute.keywords.6 + (nsubstitute 'a 0 (list 1 2 0 3 1 0 3) :key #'1- :key #'identity) + (a 2 0 3 a 0 3)) + +(deftest nsubstitute.allow-other-keys.7 + (nsubstitute 'a 0 (list 1 2 0 3 1 0 3) :allow-other-keys t + :bad t :allow-other-keys nil) + (1 2 a 3 1 a 3)) + +(deftest nsubstitute.allow-other-keys.8 + (nsubstitute 'a 0 (list 1 2 0 3 1 0 3) :allow-other-keys nil) + (1 2 a 3 1 a 3)) + + ;;; Error cases (deftest nsubstitute.error.1 diff --git a/ansi-tests/position-if-not.lsp b/ansi-tests/position-if-not.lsp index 5b7daf6771b8f814a13b26b5fe01f97054a6183e..e24e47ee2bb7f24d939068f39975fde76ba9af5c 100644 --- a/ansi-tests/position-if-not.lsp +++ b/ansi-tests/position-if-not.lsp @@ -444,6 +444,48 @@ (position-if-not (complement #'digit-char-p) a :from-end t)))) nil 0 nil 4) +;;; Keyword tests + +(deftest position-if-not.allow-other-keys.1 + (position-if-not #'zerop '(0 0 3 2 0 1) :allow-other-keys t) + 2) + +(deftest position-if-not.allow-other-keys.2 + (position-if-not #'zerop '(0 0 3 2 0 1) :allow-other-keys nil) + 2) + +(deftest position-if-not.allow-other-keys.3 + (position-if-not #'zerop '(0 0 1 2 3 0) :allow-other-keys t :bad t) + 2) + +(deftest position-if-not.allow-other-keys.4 + (position-if-not #'zerop '(0 0 1 2 3 0) :bad t :allow-other-keys t) + 2) + +(deftest position-if-not.allow-other-keys.5 + (position-if-not #'zerop '(0 0 1 2 3 0) :bad t :allow-other-keys t :key #'1-) + 0) + +(deftest position-if-not.keywords.6 + (position-if-not #'zerop '(0 0 1 2 3 0) :key #'1- :key #'identity) + 0) + +(deftest position-if-not.allow-other-keys.7 + (position-if-not #'zerop '(0 0 1 2 3 0) :bad t :allow-other-keys t + :allow-other-keys nil) + 2) + +(deftest position-if-not.allow-other-keys.8 + (position-if-not #'zerop '(0 0 1 2 3 0) :allow-other-keys t :bad t + :allow-other-keys nil) + 2) + +(deftest position-if-not.allow-other-keys.9 + (position-if-not #'zerop '(0 0 1 2 3 0) :allow-other-keys t + :allow-other-keys nil :bad t) + 2) + + ;;; Error tests (deftest position-if-not.error.1 diff --git a/ansi-tests/position-if.lsp b/ansi-tests/position-if.lsp index 0cb6314b20b6d0c7cb32b3669a91bc415d9005c2..be9855d7ffa27b66d8a8e6f83b37ec78eaddb28b 100644 --- a/ansi-tests/position-if.lsp +++ b/ansi-tests/position-if.lsp @@ -441,13 +441,55 @@ (position-if #'%g a :from-end 'foo)))) nil nil 0 4) +;;; Keyword tests + +(deftest position-if.allow-other-keys.1 + (position-if #'zerop '(1 2 0 3 2 1) :allow-other-keys t) + 2) + +(deftest position-if.allow-other-keys.2 + (position-if #'zerop '(1 2 0 3 2 1) :allow-other-keys nil) + 2) + +(deftest position-if.allow-other-keys.3 + (position-if #'zerop '(1 2 0 3 2 1) :allow-other-keys t :bad t) + 2) + +(deftest position-if.allow-other-keys.4 + (position-if #'zerop '(1 2 0 3 2 1) :bad t :allow-other-keys t) + 2) + +(deftest position-if.allow-other-keys.5 + (position-if #'zerop '(1 2 0 3 2 1) :bad t :allow-other-keys t :key #'1-) + 0) + +(deftest position-if.keywords.6 + (position-if #'zerop '(1 2 0 3 2 1) :key #'1- :key #'identity) + 0) + +(deftest position-if.allow-other-keys.7 + (position-if #'zerop '(1 2 0 3 2 1) :bad t :allow-other-keys t + :allow-other-keys nil) + 2) + +(deftest position-if.allow-other-keys.8 + (position-if #'zerop '(1 2 0 3 2 1) :allow-other-keys t :bad t + :allow-other-keys nil) + 2) + +(deftest position-if.allow-other-keys.9 + (position-if #'zerop '(1 2 0 3 2 1) :allow-other-keys t + :allow-other-keys nil :bad t) + 2) + + ;;; Error tests (deftest position-if.error.1 (classify-error (position-if #'identity 'b)) type-error) -(deftest position-if,error.2 +(deftest position-if.error.2 (classify-error (position-if #'identity 10)) type-error) diff --git a/ansi-tests/position.lsp b/ansi-tests/position.lsp index d055d8251f97b67be829953e75bd4efeea525c6a..0c446e62cad40de70d56d19245b4d114ffafb9d6 100644 --- a/ansi-tests/position.lsp +++ b/ansi-tests/position.lsp @@ -638,6 +638,47 @@ :from-end t) 4) +;;; Keyword tests + +(deftest position.allow-other-keys.1 + (position 0 '(1 2 0 3 2 1) :allow-other-keys t) + 2) + +(deftest position.allow-other-keys.2 + (position 0 '(1 2 0 3 2 1) :allow-other-keys nil) + 2) + +(deftest position.allow-other-keys.3 + (position 0 '(1 2 0 3 2 1) :allow-other-keys t :bad t) + 2) + +(deftest position.allow-other-keys.4 + (position 0 '(1 2 0 3 2 1) :bad t :allow-other-keys t) + 2) + +(deftest position.allow-other-keys.5 + (position 0 '(1 2 0 3 2 1) :bad t :allow-other-keys t :key #'1-) + 0) + +(deftest position.keywords.6 + (position 0 '(1 2 0 3 2 1) :key #'1- :key #'identity) + 0) + +(deftest position.allow-other-keys.7 + (position 0 '(1 2 0 3 2 1) :bad t :allow-other-keys t + :allow-other-keys nil) + 2) + +(deftest position.allow-other-keys.8 + (position 0 '(1 2 0 3 2 1) :allow-other-keys t :bad t + :allow-other-keys nil) + 2) + +(deftest position.allow-other-keys.9 + (position 0 '(1 2 0 3 2 1) :allow-other-keys t + :allow-other-keys nil :bad t) + 2) + ;;; Error tests (deftest position.error.1 diff --git a/ansi-tests/reduce.lsp b/ansi-tests/reduce.lsp index 7eebad571eaab6374298bf8260da35914e524467..818f40b923a9b562721cae8aaa44da56641a04d1 100644 --- a/ansi-tests/reduce.lsp +++ b/ansi-tests/reduce.lsp @@ -371,3 +371,43 @@ :element-type 'bit))) (reduce #'+ s :start 2 :end 4)) 2) + +;;; Keyword tests + +(deftest reduce.allow-other-keys.1 + (reduce #'+ '(1 2 3) :allow-other-keys t) + 6) + +(deftest reduce.allow-other-keys.2 + (reduce #'+ '(1 2 3) :allow-other-keys nil) + 6) + +(deftest reduce.allow-other-keys.3 + (reduce #'+ '(1 2 3) :bad t :allow-other-keys t) + 6) + +(deftest reduce.allow-other-keys.4 + (reduce #'+ '(1 2 3) :allow-other-keys t :bad t) + 6) + +(deftest reduce.allow-other-keys.5 + (reduce #'+ '(1 2 3) :allow-other-keys t :allow-other-keys nil :bad t) + 6) + +(deftest reduce.allow-other-keys.6 + (reduce #'+ '(1 2 3) :allow-other-keys t :bad t :allow-other-keys nil) + 6) + +(deftest reduce.allow-other-keys.7 + (reduce #'+ '(1 2 3) :bad t :allow-other-keys t :allow-other-keys nil) + 6) + +(deftest reduce.allow-other-keys.8 + (reduce #'cons '(1 2 3) :allow-other-keys t :from-end t :bad t + :initial-value nil) + (1 2 3)) + +(deftest reduce.keywords.9 + (reduce #'cons '(1 2 3) :from-end t :from-end nil + :initial-value nil :initial-value 'a) + (1 2 3)) diff --git a/ansi-tests/remove-duplicates.lsp b/ansi-tests/remove-duplicates.lsp index 69c98f95e7e843ab36e32b25fea37498192c6443..3937073fdda763c2bd9ef4f249435743cbcebeff 100644 --- a/ansi-tests/remove-duplicates.lsp +++ b/ansi-tests/remove-duplicates.lsp @@ -31,6 +31,89 @@ y) (3 4 1 5 6 2 7)) +;;; Keyword tests + +(deftest remove-duplicates.allow-other-keys.1 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) :allow-other-keys t) + (3 4 2 7 8 1 5)) + +(deftest remove-duplicates.allow-other-keys.2 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) :allow-other-keys nil) + (3 4 2 7 8 1 5)) + +(deftest remove-duplicates.allow-other-keys.3 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) :bad t :allow-other-keys t) + (3 4 2 7 8 1 5)) + +(deftest remove-duplicates.allow-other-keys.4 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) :allow-other-keys t :bad t) + (3 4 2 7 8 1 5)) + +(deftest remove-duplicates.allow-other-keys.5 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) :bad t + :allow-other-keys t :allow-other-keys nil) + (3 4 2 7 8 1 5)) + +(deftest remove-duplicates.allow-other-keys.6 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) + :allow-other-keys t :bad t :allow-other-keys nil) + (3 4 2 7 8 1 5)) + +(deftest remove-duplicates.allow-other-keys.7 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) + :allow-other-keys t :allow-other-keys nil :bad t) + (3 4 2 7 8 1 5)) + +(deftest remove-duplicates.allow-other-keys.8 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) + :allow-other-keys t :from-end t) + (1 2 3 4 7 8 5)) + +(deftest remove-duplicates.keywords.1 + (remove-duplicates '(1 2 3 4 2 7 8 1 5) :from-end t :from-end nil) + (1 2 3 4 7 8 5)) + + +(deftest delete-duplicates.allow-other-keys.1 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) :allow-other-keys t) + (3 4 2 7 8 1 5)) + +(deftest delete-duplicates.allow-other-keys.2 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) :allow-other-keys nil) + (3 4 2 7 8 1 5)) + +(deftest delete-duplicates.allow-other-keys.3 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) :bad t :allow-other-keys t) + (3 4 2 7 8 1 5)) + +(deftest delete-duplicates.allow-other-keys.4 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) :allow-other-keys t :bad t) + (3 4 2 7 8 1 5)) + +(deftest delete-duplicates.allow-other-keys.5 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) :bad t + :allow-other-keys t :allow-other-keys nil) + (3 4 2 7 8 1 5)) + +(deftest delete-duplicates.allow-other-keys.6 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) + :allow-other-keys t :bad t :allow-other-keys nil) + (3 4 2 7 8 1 5)) + +(deftest delete-duplicates.allow-other-keys.7 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) + :allow-other-keys t :allow-other-keys nil :bad t) + (3 4 2 7 8 1 5)) + +(deftest delete-duplicates.allow-other-keys.8 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) + :allow-other-keys t :from-end t) + (1 2 3 4 7 8 5)) + +(deftest delete-duplicates.keywords.1 + (delete-duplicates (list 1 2 3 4 2 7 8 1 5) :from-end t :from-end nil) + (1 2 3 4 7 8 5)) + ;;; Error cases (deftest remove-duplicates.error.1 diff --git a/ansi-tests/remove.lsp b/ansi-tests/remove.lsp index 473197ce996b519250efb39d5fad3f12f13de38e..04743db216210cbc2b63cd9d953205f2aa37dac8 100644 --- a/ansi-tests/remove.lsp +++ b/ansi-tests/remove.lsp @@ -477,6 +477,69 @@ y) (1 3 6 1 4 1 3 7)) +;;; Keyword tests + +(deftest remove.allow-other-keys.1 + (remove 'a '(a b c a d) :allow-other-keys t) + (b c d)) + +(deftest remove.allow-other-keys.2 + (remove 'a '(a b c a d) :allow-other-keys nil) + (b c d)) + +(deftest remove.allow-other-keys.3 + (remove 'a '(a b c a d) :bad t :allow-other-keys t) + (b c d)) + +(deftest remove.allow-other-keys.4 + (remove 'a '(a b c a d) :allow-other-keys t :bad t :bad nil) + (b c d)) + +(deftest remove.allow-other-keys.5 + (remove 'a '(a b c a d) :bad1 t :allow-other-keys t :bad2 t + :allow-other-keys nil :bad3 t) + (b c d)) + +(deftest remove.allow-other-keys.6 + (remove 'a '(a b c a d) :allow-other-keys t :from-end t :count 1) + (a b c d)) + +(deftest remove.keywords.7 + (remove 'a '(a b c a d) :from-end t :count 1 :from-end nil :count 10) + (a b c d)) + + +(deftest delete.allow-other-keys.1 + (delete 'a (copy-seq '(a b c a d)) :allow-other-keys t) + (b c d)) + +(deftest delete.allow-other-keys.2 + (delete 'a (copy-seq '(a b c a d)) :allow-other-keys nil) + (b c d)) + +(deftest delete.allow-other-keys.3 + (delete 'a (copy-seq '(a b c a d)) :bad t :allow-other-keys t) + (b c d)) + +(deftest delete.allow-other-keys.4 + (delete 'a (copy-seq '(a b c a d)) :allow-other-keys t :bad t :bad nil) + (b c d)) + +(deftest delete.allow-other-keys.5 + (delete 'a (copy-seq '(a b c a d)) :bad1 t :allow-other-keys t :bad2 t + :allow-other-keys nil :bad3 t) + (b c d)) + +(deftest delete.allow-other-keys.6 + (delete 'a (copy-seq '(a b c a d)) :allow-other-keys t :from-end t :count 1) + (a b c d)) + +(deftest delete.keywords.7 + (delete 'a (copy-seq '(a b c a d)) + :from-end t :count 1 :from-end nil :count 10) + (a b c d)) + + ;;; Error cases diff --git a/ansi-tests/replace.lsp b/ansi-tests/replace.lsp index af21cc8746db008913590b7dde79bc501cb166d1..6f582419b656b0a391c4b9120c71e558ed22706c 100644 --- a/ansi-tests/replace.lsp +++ b/ansi-tests/replace.lsp @@ -586,6 +586,41 @@ t "aabcef") +;;; Keyword tests + +(deftest replace.allow-other-keys.1 + (replace (copy-seq "abcdefg") "xyz" :allow-other-keys t) + "xyzdefg") + +(deftest replace.allow-other-keys.2 + (replace (copy-seq "abcdefg") "xyz" :allow-other-keys nil) + "xyzdefg") + +(deftest replace.allow-other-keys.3 + (replace (copy-seq "abcdefg") "xyz" :allow-other-keys t :bad t) + "xyzdefg") + +(deftest replace.allow-other-keys.4 + (replace (copy-seq "abcdefg") "xyz" :bad t :allow-other-keys t) + "xyzdefg") + +(deftest replace.allow-other-keys.5 + (replace (copy-seq "abcdefg") "xyz" :bad1 t :allow-other-keys t + :bad2 t :allow-other-keys nil :bad3 nil) + "xyzdefg") + +(deftest replace.allow-other-keys.6 + (replace (copy-seq "abcdefg") "xyz" :allow-other-keys t :start1 1) + "axyzefg") + +(deftest replace.keywords.7 + (replace (copy-seq "abcdefg") "xyz" :start1 0 :start2 0 :end1 3 :end2 3 + :start1 1 :start2 1 :end1 2 :end1 2) + "xyzdefg") + + + + ;;; Error cases (deftest replace.error.1 diff --git a/ansi-tests/search-list.lsp b/ansi-tests/search-list.lsp index c9f80bb965f9d1e38270aad53d63fdbe77db453d..7cb5cc24627753cac3fb38dd5a93fc6b9f292d90 100644 --- a/ansi-tests/search-list.lsp +++ b/ansi-tests/search-list.lsp @@ -134,6 +134,44 @@ collect pat)) nil) +;;; Keyword tests + +(deftest search.allow-other-keys.1 + (search '(c d) '(a b c d c d e) :allow-other-keys t) + 2) + +(deftest search.allow-other-keys.2 + (search '(c d) '(a b c d c d e) :allow-other-keys nil) + 2) + +(deftest search.allow-other-keys.3 + (search '(c d) '(a b c d c d e) :bad t :allow-other-keys t) + 2) + +(deftest search.allow-other-keys.4 + (search '(c d) '(a b c d c d e) :allow-other-keys 'foo :bad nil) + 2) + +(deftest search.allow-other-keys.5 + (search '(c d) '(a b c d c d e) :bad1 1 :allow-other-keys t :bad2 2 + :allow-other-keys nil :bad3 3) + 2) + +(deftest search.allow-other-keys.6 + (search '(c d) '(a b c d c d e) :allow-other-keys 'foo + :from-end t) + 4) + +(deftest search.allow-other-keys.7 + (search '(c d) '(a b c d c d e) :from-end t :allow-other-keys t) + 4) + +(deftest search.keywords.8 + (search '(c d) '(a b c d c d e) :start1 0 :start2 0 :start1 1 + :start2 6 :from-end t :from-end nil) + 4) + + ;;; Error cases (deftest search.error.1 diff --git a/ansi-tests/substitute-if-not.lsp b/ansi-tests/substitute-if-not.lsp index 300d1afa3d4c06ecd9e49c06f49997b62406762f..603709c96088e644bd61433113eeb3f355cc19a4 100644 --- a/ansi-tests/substitute-if-not.lsp +++ b/ansi-tests/substitute-if-not.lsp @@ -711,6 +711,47 @@ result) #*01111) +;;; Keyword tests + +(deftest substitute-if-not.allow-other-keys.1 + (substitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) + :allow-other-keys t :bad t) + (a a 0 a a 0 a)) + +(deftest substitute-if-not.allow-other-keys.2 + (substitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) + :bad t :allow-other-keys t) + (a a 0 a a 0 a)) + +(deftest substitute-if-not.allow-other-keys.3 + (substitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t + :allow-other-keys nil :bad t) + (a a 0 a a 0 a)) + +(deftest substitute-if-not.allow-other-keys.4 + (substitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) :bad t + :allow-other-keys t :allow-other-keys nil) + (a a 0 a a 0 a)) + +(deftest substitute-if-not.allow-other-keys.5 + (substitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) + :allow-other-keys t :key #'1-) + (1 a a a 1 a a)) + +(deftest substitute-if-not.keywords.6 + (substitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) + :key #'1- :key #'identity) + (1 a a a 1 a a)) + +(deftest substitute-if-not.allow-other-keys.7 + (substitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t + :bad t :allow-other-keys nil) + (a a 0 a a 0 a)) + +(deftest substitute-if-not.allow-other-keys.8 + (substitute-if-not 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys nil) + (a a 0 a a 0 a)) + ;;; Error cases (deftest substitute-if-not.error.1 diff --git a/ansi-tests/substitute-if.lsp b/ansi-tests/substitute-if.lsp index 5a18608c394f100b9dcb6e82b7517df5e1953d4b..186762c0da6c8d50b28f0c7ecc551cada1c98bae 100644 --- a/ansi-tests/substitute-if.lsp +++ b/ansi-tests/substitute-if.lsp @@ -735,6 +735,44 @@ result) #*01111) +;;; Keyword tests + +(deftest substitute-if.allow-other-keys.1 + (substitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t :bad t) + (1 2 a 3 1 a 3)) + +(deftest substitute-if.allow-other-keys.2 + (substitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :bad t :allow-other-keys t) + (1 2 a 3 1 a 3)) + +(deftest substitute-if.allow-other-keys.3 + (substitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t + :allow-other-keys nil :bad t) + (1 2 a 3 1 a 3)) + +(deftest substitute-if.allow-other-keys.4 + (substitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :bad t + :allow-other-keys t :allow-other-keys nil) + (1 2 a 3 1 a 3)) + +(deftest substitute-if.allow-other-keys.5 + (substitute-if 'a #'zerop (list 1 2 0 3 1 0 3) + :allow-other-keys t :key #'1-) + (a 2 0 3 a 0 3)) + +(deftest substitute-if.keywords.6 + (substitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :key #'1- :key #'identity) + (a 2 0 3 a 0 3)) + +(deftest substitute-if.allow-other-keys.7 + (substitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys t + :bad t :allow-other-keys nil) + (1 2 a 3 1 a 3)) + +(deftest substitute-if.allow-other-keys.8 + (substitute-if 'a #'zerop (list 1 2 0 3 1 0 3) :allow-other-keys nil) + (1 2 a 3 1 a 3)) + ;;; Error cases (deftest substitute-if.error.1 diff --git a/ansi-tests/substitute.lsp b/ansi-tests/substitute.lsp index 6aab7c2f4b9364324ea02bab80814abd108a34e8..eaffad366c70581aa547cc1685c68c3dcf887092 100644 --- a/ansi-tests/substitute.lsp +++ b/ansi-tests/substitute.lsp @@ -966,6 +966,44 @@ result) #*01111) +;;; Keyword tests + +(deftest substitute.allow-other-keys.1 + (substitute 'a 0 (list 1 2 0 3 1 0 3) :allow-other-keys t :bad t) + (1 2 a 3 1 a 3)) + +(deftest substitute.allow-other-keys.2 + (substitute 'a 0 (list 1 2 0 3 1 0 3) :bad t :allow-other-keys t) + (1 2 a 3 1 a 3)) + +(deftest substitute.allow-other-keys.3 + (substitute 'a 0 (list 1 2 0 3 1 0 3) :allow-other-keys t + :allow-other-keys nil :bad t) + (1 2 a 3 1 a 3)) + +(deftest substitute.allow-other-keys.4 + (substitute 'a 0 (list 1 2 0 3 1 0 3) :bad t + :allow-other-keys t :allow-other-keys nil) + (1 2 a 3 1 a 3)) + +(deftest substitute.allow-other-keys.5 + (substitute 'a 0 (list 1 2 0 3 1 0 3) + :allow-other-keys t :key #'1-) + (a 2 0 3 a 0 3)) + +(deftest substitute.keywords.6 + (substitute 'a 0 (list 1 2 0 3 1 0 3) :key #'1- :key #'identity) + (a 2 0 3 a 0 3)) + +(deftest substitute.allow-other-keys.7 + (substitute 'a 0 (list 1 2 0 3 1 0 3) :allow-other-keys t + :bad t :allow-other-keys nil) + (1 2 a 3 1 a 3)) + +(deftest substitute.allow-other-keys.8 + (substitute 'a 0 (list 1 2 0 3 1 0 3) :allow-other-keys nil) + (1 2 a 3 1 a 3)) + ;;; Error cases (deftest substitute.error.1