diff options
author | Chouser <chouser@n01se.net> | 2008-12-13 03:00:56 +0000 |
---|---|---|
committer | Chouser <chouser@n01se.net> | 2008-12-13 03:00:56 +0000 |
commit | 53b9eefca47dded478eda66af78cfbd20b8b7f35 (patch) | |
tree | 4ab8e6dac0df68215350a97e9cc5474502085543 /src/clojure/contrib/test_clojure | |
parent | 4328938ee349a976f34286564213371d656f0a77 (diff) |
Add tests of 'for' with :when/:while on same binding form.
Diffstat (limited to 'src/clojure/contrib/test_clojure')
-rw-r--r-- | src/clojure/contrib/test_clojure/for.clj | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/clojure/contrib/test_clojure/for.clj b/src/clojure/contrib/test_clojure/for.clj index 5303013c..1e4d7063 100644 --- a/src/clojure/contrib/test_clojure/for.clj +++ b/src/clojure/contrib/test_clojure/for.clj @@ -82,6 +82,12 @@ [x y]) '([1 0] [3 0])))) +(deftest While-and-When-Same-Binding + (is (= (for [x (only 6) :while (< x 5) :when (odd? x)] x) '(1 3))) + (is (= (for [x (only 6) + :while (< x 5) ; if :while is false, :when should not be evaled + :when (do (is (< x 5) (odd? x)))] x) '(1 3)))) + (deftest Nesting (is (= (for [x '(a b) y (interpose x '(1 2)) z (list x y)] [x y z]) '([a 1 a] [a 1 1] [a a a] [a a a] [a 2 a] [a 2 2] |