Skip to content
Snippets Groups Projects
Commit 4f5a74ac authored by pfdietz's avatar pfdietz
Browse files

Added some more destructuring-bind tests, for key, optional, and aux variables

parent 2ec03da8
No related branches found
No related tags found
No related merge requests found
...@@ -33,9 +33,13 @@ ...@@ -33,9 +33,13 @@
a b w nil) a b w nil)
(deftest destructuring-bind.7 (deftest destructuring-bind.7
(destructuring-bind (x y &optional (z 'w z-p)) '(a b c) (values x y z z-p)) (destructuring-bind (x y &optional (z 'w z-p)) '(a b c) (values x y z (notnot z-p)))
a b c t) a b c t)
(deftest destructuring-bind.7a
(destructuring-bind (x y &optional (z x z-p)) '(a b) (values x y z z-p))
a b a nil)
(deftest destructuring-bind.8 (deftest destructuring-bind.8
(destructuring-bind (x y &optional z w) '(a b c) (values x y z w)) (destructuring-bind (x y &optional z w) '(a b c) (values x y z w))
a b c nil) a b c nil)
...@@ -56,6 +60,10 @@ ...@@ -56,6 +60,10 @@
(destructuring-bind (x y &body z) '(a b c d) (values x y z)) (destructuring-bind (x y &body z) '(a b c d) (values x y z))
a b (c d)) a b (c d))
(deftest destructuring-bind.12a
(destructuring-bind ((x y &body z)) '((a b c d)) (values x y z))
a b (c d))
(deftest destructuring-bind.13 (deftest destructuring-bind.13
(destructuring-bind (&whole x y z) '(a b) (values x y z)) (destructuring-bind (&whole x y z) '(a b) (values x y z))
(a b) a b) (a b) a b)
...@@ -76,6 +84,15 @@ ...@@ -76,6 +84,15 @@
(destructuring-bind (&key a b c) '(:c 1) (values a b c)) (destructuring-bind (&key a b c) '(:c 1) (values a b c))
nil nil 1) nil nil 1)
(deftest destructuring-bind.17a
(destructuring-bind (&key (a 'foo) (b 'bar) c) '(:c 1) (values a b c))
foo bar 1)
(deftest destructuring-bind.17c
(destructuring-bind (&key (a 'foo a-p) (b a b-p) (c 'zzz c-p)) '(:c 1)
(values a b c a-p b-p (notnot c-p)))
foo foo 1 nil nil t)
(deftest destructuring-bind.18 (deftest destructuring-bind.18
(destructuring-bind ((&key a b c)) '((:c 1 :b 2)) (values a b c)) (destructuring-bind ((&key a b c)) '((:c 1 :b 2)) (values a b c))
nil 2 1) nil 2 1)
...@@ -136,6 +153,14 @@ ...@@ -136,6 +153,14 @@
(declare)) (declare))
nil) nil)
(deftest destructuring-bind.29
(destructuring-bind (x &aux y) '(:foo) (values x y))
:foo nil)
(deftest destructuring-bind.30
(destructuring-bind (x &aux (y (list x))) '(:foo) (values x y))
:foo (:foo))
;;; Error cases ;;; Error cases
#| #|
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment