Skip to content

Commit 8a27f89

Browse files
thomasmulvaneyswannodette
authored andcommitted
CLJS-2083: Test equiv-map for maps which do not impl IKVReduce
1 parent 73447c5 commit 8a27f89

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/test/cljs/cljs/core_test.cljs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,18 @@
13081308
(is (not= r sm))
13091309
(is (not= sm r)))))
13101310

1311+
(deftype MapWithNoIKVReduce [backing-map]
1312+
IMap
1313+
(-dissoc [_ _] nil)
1314+
1315+
ISeqable
1316+
(-seq [_] (seq backing-map)))
1317+
1318+
(deftest test-cljs-2083
1319+
(testing "maps which do not implement IKVReduce can be compared"
1320+
(is (true? (equiv-map (MapWithNoIKVReduce. {:a 1 :b 2 :c 3}) {:a 1 :b 2 :c 3})))
1321+
(is (false? (equiv-map (MapWithNoIKVReduce. {:a 1 :b 2 :c 3}) {:a 1 :b 2 :c 4})))))
1322+
13111323
(comment
13121324
;; ObjMap
13131325
;; (let [ks (map (partial str "foo") (range 500))

0 commit comments

Comments
 (0)