Skip to content

Commit 73c38b8

Browse files
Tests for meta preservation in conj (#779)
* Add tests for meta-preservation in `conj` * Prep for jank as well
1 parent 0e979c3 commit 73c38b8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

test/clojure/core_test/conj.cljc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
(is (= {:a 2} (conj {:a 0} {:a 1} {:a 2})))
2525
(is (= ["a" "b" "c" ["d" "e" "f"]] (conj ["a" "b" "c"] ["d" "e" "f"])))
2626

27-
#?@(:cljs [(is (thrown? js/Error (conj \a \b)))
27+
#?@(:jank []
28+
:cljs [(is (thrown? js/Error (conj \a \b)))
2829
(is (thrown? js/Error (conj 1 2)))
2930
(is (thrown? js/Error (conj :a :b)))
3031
(is (thrown? js/Error (conj {:a 0} '(:b 1))))]
@@ -34,6 +35,11 @@
3435
(is (thrown? Exception (conj 1 2)))
3536
(is (thrown? Exception (conj :a :b)))
3637
(is (thrown? Exception (conj {:a 0} '(:b 1))))]))
38+
39+
(testing "meta preservation"
40+
(let [meta-data {:foo 42}
41+
apply-meta #(-> % (with-meta meta-data) (conj [:k :v]) meta)]
42+
(is (= meta-data (apply-meta {}) (apply-meta []) (apply-meta #{}) (apply-meta '())))))
3743

3844
(when-var-exists clojure.core/first
3945
(testing "first"

0 commit comments

Comments
 (0)