diff options
| author | Stuart Halloway <stu@thinkrelevance.com> | 2010-06-04 15:43:10 -0400 |
|---|---|---|
| committer | Stuart Halloway <stu@thinkrelevance.com> | 2010-06-07 10:03:40 -0400 |
| commit | 725547f4587f75c063c51659e582cfdbcc140f80 (patch) | |
| tree | 59276e45d5b8e29438fe59e9cc8d7fa966baf355 /test | |
| parent | 24442426af1fe643d904b4adfcf62fd7a1cf3ff7 (diff) | |
tidy up and test #257, remove spurious .rej file
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/clojure/test_clojure/other_functions.clj | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/clojure/test_clojure/other_functions.clj b/test/clojure/test_clojure/other_functions.clj index afb67631..879af7e1 100644 --- a/test/clojure/test_clojure/other_functions.clj +++ b/test/clojure/test_clojure/other_functions.clj @@ -51,6 +51,15 @@ "quux" "quux")) (deftest test-fnil + (let [f1 (fnil vector :a) + f2 (fnil vector :a :b) + f3 (fnil vector :a :b :c)] + (are [result input] (= result [(apply f1 input) (apply f2 input) (apply f3 input)]) + [[1 2 3 4] [1 2 3 4] [1 2 3 4]] [1 2 3 4] + [[:a 2 3 4] [:a 2 3 4] [:a 2 3 4]] [nil 2 3 4] + [[:a nil 3 4] [:a :b 3 4] [:a :b 3 4]] [nil nil 3 4] + [[:a nil nil 4] [:a :b nil 4] [:a :b :c 4]] [nil nil nil 4] + [[:a nil nil nil] [:a :b nil nil] [:a :b :c nil]] [nil nil nil nil])) (are [x y] (= x y) ((fnil + 0) nil 42) 42 ((fnil conj []) nil 42) [42] |
