aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrantisek Sodomka <fsodomka@gmail.com>2009-03-06 21:30:28 +0000
committerFrantisek Sodomka <fsodomka@gmail.com>2009-03-06 21:30:28 +0000
commit25519dac03a0801208286128882dd3bacd2995d3 (patch)
treea8801f89a4c0b5d0d12275116978d4cbd3ac8a08
parent6037e78cb29b399004b37ef4be42fe0da68b935d (diff)
test data structures: find
-rw-r--r--src/clojure/contrib/test_clojure/data_structures.clj16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/clojure/contrib/test_clojure/data_structures.clj b/src/clojure/contrib/test_clojure/data_structures.clj
index 16cae04a..5b4c4183 100644
--- a/src/clojure/contrib/test_clojure/data_structures.clj
+++ b/src/clojure/contrib/test_clojure/data_structures.clj
@@ -326,6 +326,22 @@
;; *** Maps (IPersistentMap) ***
+(deftest test-find
+ (are (= _1 _2)
+ (find {} :a) nil
+
+ (find {:a 1} :a) [:a 1]
+ (find {:a 1} :b) nil
+
+ (find {:a 1 :b 2} :a) [:a 1]
+ (find {:a 1 :b 2} :b) [:b 2]
+ (find {:a 1 :b 2} :c) nil
+
+ (find {} nil) nil
+ (find {:a 1} nil) nil
+ (find {:a 1 :b 2} nil) nil ))
+
+
(deftest test-keys
(are (= _1 _2) ; other than map data structures
(keys ()) nil