Commit 1a87ed65 authored by pfdietz's avatar pfdietz

Added keyword processing tests for FIND, FIND-IF, and FIND-IF-NOT.

parent 015f0fda
......@@ -484,6 +484,33 @@
(nil #\6)
(#\6)))
;;; Keyword tests
(deftest find-if-not.allow-other-keys.1
(find-if-not #'oddp '(1 2 3 4 5) :bad t :allow-other-keys t)
2)
(deftest find-if-not.allow-other-keys.2
(find-if-not #'oddp '(1 2 3 4 5) :allow-other-keys t :also-bad t)
2)
;;; The leftmost of two :allow-other-keys arguments is the one that matters.
(deftest find-if-not.allow-other-keys.3
(find-if-not #'oddp '(1 2 3 4 5)
:allow-other-keys t
:allow-other-keys nil
:bad t)
2)
(deftest find-if-not.keywords.4
(find-if-not #'oddp '(1 2 3 4 5) :key #'identity :key #'1+)
2)
(deftest find-if-not.allow-other-keys.5
(find-if-not #'null '(nil a b c nil) :allow-other-keys nil)
a)
;;; Error tests
(deftest find-if-not.error.1
......
......@@ -507,6 +507,33 @@
))
#\2 #\4 #\1 #\5)
;;; Keyword tests
(deftest find-if.allow-other-keys.1
(find-if #'evenp '(1 2 3 4 5) :bad t :allow-other-keys t)
2)
(deftest find-if.allow-other-keys.2
(find-if #'evenp '(1 2 3 4 5) :allow-other-keys t :also-bad t)
2)
;;; The leftmost of two :allow-other-keys arguments is the one that matters.
(deftest find-if.allow-other-keys.3
(find-if #'evenp '(1 2 3 4 5)
:allow-other-keys t
:allow-other-keys nil
:bad t)
2)
(deftest find-if.keywords.4
(find-if #'evenp '(1 2 3 4 5) :key #'identity :key #'1+)
2)
(deftest find-if.allow-other-keys.5
(find-if #'identity '(nil a b c nil) :allow-other-keys nil)
a)
;;; Error tests
(deftest find-if.error.1
......
......@@ -741,6 +741,35 @@
(#\a #\b #\c #\d #\e nil nil nil nil nil)
(#\a #\b #\c #\d #\e nil nil nil nil nil))
;;; Keyword tests
(deftest find.allow-other-keys.1
(find 0 '(1 2 3 4 5) :key #'(lambda (x) (mod x 2))
:bad t :allow-other-keys t)
2)
(deftest find.allow-other-keys.2
(find 0 '(1 2 3 4 5) :key #'(lambda (x) (mod x 2))
:allow-other-keys t :also-bad t)
2)
;;; The leftmost of two :allow-other-keys arguments is the one that matters.
(deftest find.allow-other-keys.3
(find 0 '(1 2 3 4 5) :key #'(lambda (x) (mod x 2))
:allow-other-keys t
:allow-other-keys nil
:bad t)
2)
(deftest find.keywords.4
(find 2 '(1 2 3 4 5) :key #'identity :key #'1+)
2)
(deftest find.allow-other-keys.5
(find 'b '(nil a b c nil) :allow-other-keys nil)
b)
;;; Error tests
(deftest find.error.1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment