From b9d1a8a5c77f1b8a5f62ac6685e2cd7050a472a7 Mon Sep 17 00:00:00 2001 From: rafonsecad Date: Fri, 24 Oct 2025 09:02:25 -0500 Subject: [PATCH 1/3] test conj --- test/clojure/core_test/conj.cljc | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/clojure/core_test/conj.cljc diff --git a/test/clojure/core_test/conj.cljc b/test/clojure/core_test/conj.cljc new file mode 100644 index 0000000..8d550df --- /dev/null +++ b/test/clojure/core_test/conj.cljc @@ -0,0 +1,33 @@ +(ns clojure.core-test.conj + (:require [clojure.test :as t :refer [deftest testing is are]] + [clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]])) + +(when-var-exists conj + (deftest test-conj + (testing "common" + (is (= nil (conj nil))) + (is (= '(nil) (conj nil nil))) + (is (= {} (conj {}))) + (is (= #{} (conj #{}))) + (is (= '() (conj '()))) + (is (= '(3) (conj nil 3))) + (is (= '([1 2]) (conj nil [1 2]))) + (is (= [1 2 3 4] (conj [1 2 3] 4))) + (is (= '(4 1 2 3) (conj '(1 2 3) 4))) + (is (= '(\f \e \d \a \b \c) (conj '(\a \b \c) \d \e \f))) + (is (= [[1 2] [3 4] [5 6]] (conj [[1 2] [3 4]] [5 6]))) + (is (= {:a 0 :b 1} (conj {:a 0} [:b 1]))) + (is (= {:a 0 :b 1} (conj {:a 0} {:b 1}))) + (is (= #{1 #{2}} (conj #{1} #{2}))) + (is (= ["a" "b" "c" ["d" "e" "f"]] (conj ["a" "b" "c"] ["d" "e" "f"]))) + + #?@(:cljs [(is (thrown? js/Error (conj \a \b))) + (is (thrown? js/Error (conj 1 2))) + (is (thrown? js/Error (conj :a :b))) + (is (thrown? js/Error (conj {:a 0} '(:b 1))))] + + :default [(is (thrown? Exception (conj "a" "b"))) + (is (thrown? Exception (conj \a \b))) + (is (thrown? Exception (conj 1 2))) + (is (thrown? Exception (conj :a :b))) + (is (thrown? Exception (conj {:a 0} '(:b 1))))])))) From 41f7fea5f2b5510ff765e22117d05fccd4b2c8fc Mon Sep 17 00:00:00 2001 From: rafonsecad Date: Fri, 24 Oct 2025 22:25:45 -0500 Subject: [PATCH 2/3] test conj --- test/clojure/core_test/conj.cljc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/clojure/core_test/conj.cljc b/test/clojure/core_test/conj.cljc index 8d550df..60617b1 100644 --- a/test/clojure/core_test/conj.cljc +++ b/test/clojure/core_test/conj.cljc @@ -19,6 +19,8 @@ (is (= {:a 0 :b 1} (conj {:a 0} [:b 1]))) (is (= {:a 0 :b 1} (conj {:a 0} {:b 1}))) (is (= #{1 #{2}} (conj #{1} #{2}))) + (is (= {:a 1} (conj {:a 0} {:a 1}))) + (is (= {:a 2} (conj {:a 0} {:a 1} {:a 2}))) (is (= ["a" "b" "c" ["d" "e" "f"]] (conj ["a" "b" "c"] ["d" "e" "f"]))) #?@(:cljs [(is (thrown? js/Error (conj \a \b))) @@ -30,4 +32,8 @@ (is (thrown? Exception (conj \a \b))) (is (thrown? Exception (conj 1 2))) (is (thrown? Exception (conj :a :b))) - (is (thrown? Exception (conj {:a 0} '(:b 1))))])))) + (is (thrown? Exception (conj {:a 0} '(:b 1))))])) + + (when-var-exists clojure.core/first + (testing "first" + (is (= -1 (first (conj (range) -1)))))))) From 8ada974ea7569c76e33b9d9a7ca4872e933c5a1e Mon Sep 17 00:00:00 2001 From: rafonsecad Date: Sun, 26 Oct 2025 21:17:50 -0500 Subject: [PATCH 3/3] test conj --- test/clojure/core_test/conj.cljc | 1 + 1 file changed, 1 insertion(+) diff --git a/test/clojure/core_test/conj.cljc b/test/clojure/core_test/conj.cljc index 60617b1..8163193 100644 --- a/test/clojure/core_test/conj.cljc +++ b/test/clojure/core_test/conj.cljc @@ -5,6 +5,7 @@ (when-var-exists conj (deftest test-conj (testing "common" + (is (= [] (conj))) (is (= nil (conj nil))) (is (= '(nil) (conj nil nil))) (is (= {} (conj {})))