From be47c56a002fbc9a222d86c266c71dd60824302d Mon Sep 17 00:00:00 2001 From: Emma Griffin Date: Thu, 4 Sep 2025 21:07:33 -0600 Subject: [PATCH 1/8] Add cljr Instructions --- README.md | 11 +++++++++++ deps.edn | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fa86501..8a0704a 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,17 @@ Once tests are compiled they can be ran with: node target/js/node-tests.js ``` +## Running the ClojureCLR tests + +### Pre-requisites +- [dotnet](https://dotnet.microsoft.com/en-us/download) +- `ClojureCLR`: `dotnet tool install --global Clojure.Main --version 1.12.0-alpha10` +- `cljr`: `dotnet tool install --global Clojure.Cljr --version 0.1.0-alpha5` + +```bash +cljr -X:test-cljr +``` + ### Automated test running during development If you want to autorun the tests during development run the following: diff --git a/deps.edn b/deps.edn index cb36f2d..c8be104 100644 --- a/deps.edn +++ b/deps.edn @@ -1 +1,8 @@ -{:paths ["test"]} +{:paths ["test"] + :aliases + {:test-cljr + {:extra-deps {io.github.clojure/clr.tools.reader {:git/tag "v1.5.0" :git/sha "46ce896"} + io.github.dmiller/test-runner {:git/sha "c055ea13d19c6a9b9632aa2370fcc2215c8043c3"}} + :exec-fn cognitect.test-runner.api/test + :exec-args {:dirs ["test"] + :patterns [".*"]}}}} From 8102ff8c3b83d392be9efc3516bced3b0db0d70c Mon Sep 17 00:00:00 2001 From: Emma Griffin Date: Thu, 4 Sep 2025 21:23:18 -0600 Subject: [PATCH 2/8] Add ClojureCLR GitHub Actions Workflow --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 301833b..dd413d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,14 @@ jobs: key: cljdeps-${{ env.CACHE_VERSION }}-${{ hashFiles('project.clj') }}-${{ hashFiles('deps.edn') }}-${{ hashFiles('bb.edn') }} restore-keys: cljdeps-${{ env.CACHE_VERSION }}- + - name: Prepare dotnet + uses: xt0rted/setup-dotnet@v1.5.0 + + - name: Install ClojureCLR + run: | + dotnet tool install --global Clojure.Main --version 1.12.0-alpha10 + dotnet tool install --global Clojure.Cljr --version 0.1.0-alpha5 + - name: Prepare node uses: actions/setup-node@v4 with: @@ -61,5 +69,8 @@ jobs: - name: Run Clojure tests run: lein test + - name: Run ClojureCLR Tests + run: cljr -X:test-cljr + - name: Run babashka tests run: bb test-bb From 193c9ee07e656a4621e7b728f9d6024bc9904b13 Mon Sep 17 00:00:00 2001 From: Emma Griffin Date: Tue, 9 Sep 2025 13:09:45 -0600 Subject: [PATCH 3/8] Bump ClojureCLR --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd413d3..c38a593 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: Install ClojureCLR run: | - dotnet tool install --global Clojure.Main --version 1.12.0-alpha10 + dotnet tool install --global Clojure.Main --version 1.12.2 dotnet tool install --global Clojure.Cljr --version 0.1.0-alpha5 - name: Prepare node From 74e25f1922b3d0d7d549f84713a8b8bf83006778 Mon Sep 17 00:00:00 2001 From: Emma Griffin Date: Tue, 9 Sep 2025 17:15:50 -0600 Subject: [PATCH 4/8] Fix syntax + bump --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c38a593..c20cf83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - name: Install ClojureCLR run: | dotnet tool install --global Clojure.Main --version 1.12.2 - dotnet tool install --global Clojure.Cljr --version 0.1.0-alpha5 + dotnet tool install --global Clojure.Cljr --version 0.1.0-alpha6 - name: Prepare node uses: actions/setup-node@v4 @@ -70,7 +70,7 @@ jobs: run: lein test - name: Run ClojureCLR Tests - run: cljr -X:test-cljr + run: cljr -X:test - name: Run babashka tests run: bb test-bb From 56f0d4e2cb8070b0f11754397b9369657897e6e8 Mon Sep 17 00:00:00 2001 From: Emma Griffin Date: Tue, 9 Sep 2025 17:16:43 -0600 Subject: [PATCH 5/8] Remove redundant deps.edn --- deps.edn | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 deps.edn diff --git a/deps.edn b/deps.edn deleted file mode 100644 index c8be104..0000000 --- a/deps.edn +++ /dev/null @@ -1,8 +0,0 @@ -{:paths ["test"] - :aliases - {:test-cljr - {:extra-deps {io.github.clojure/clr.tools.reader {:git/tag "v1.5.0" :git/sha "46ce896"} - io.github.dmiller/test-runner {:git/sha "c055ea13d19c6a9b9632aa2370fcc2215c8043c3"}} - :exec-fn cognitect.test-runner.api/test - :exec-args {:dirs ["test"] - :patterns [".*"]}}}} From ba6360790e451498f7bd893582a3c5a525f777f6 Mon Sep 17 00:00:00 2001 From: Emma Griffin Date: Tue, 9 Sep 2025 17:21:30 -0600 Subject: [PATCH 6/8] Update README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ec33b13..8ddd074 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,11 @@ node target/js/node-tests.js ### Pre-requisites - [dotnet](https://dotnet.microsoft.com/en-us/download) -- `ClojureCLR`: `dotnet tool install --global Clojure.Main --version 1.12.0-alpha10` -- `cljr`: `dotnet tool install --global Clojure.Cljr --version 0.1.0-alpha5` +- `ClojureCLR`: `dotnet tool install --global Clojure.Main --version 1.12.2` +- `cljr`: `dotnet tool install --global Clojure.Cljr --version 0.1.0-alpha6` ```bash -cljr -X:test-cljr +cljr -X:test ``` ### Automated test running during development From 01550997fc5ee955a310d7d1a9a86a5c8f20d180 Mon Sep 17 00:00:00 2001 From: Emma Griffin Date: Tue, 9 Sep 2025 17:50:45 -0600 Subject: [PATCH 7/8] Fix cljr tests --- test/clojure/core_test/merge.cljc | 58 ++++++++++++++++--------------- test/clojure/core_test/val.cljc | 46 ++++++++++++------------ 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/test/clojure/core_test/merge.cljc b/test/clojure/core_test/merge.cljc index 904db0c..43bdf4e 100644 --- a/test/clojure/core_test/merge.cljc +++ b/test/clojure/core_test/merge.cljc @@ -45,34 +45,36 @@ {:b "b"})))) (testing "vectors in position 2+ are treated as map-entries, per `conj`" - (is (thrown? #?(:cljs :default, :clj java.lang.IllegalArgumentException, :clr Exception) - (merge {} []))) - (is (thrown? #?(:cljs :default, :clj java.lang.IllegalArgumentException, :clr Exception) - (merge {} [:foo]))) + #?(:cljs (is (thrown? js/Error (merge {} []))) + :clj (is (thrown? java.lang.IllegalArgumentException (merge {} []))) + :default (is (thrown? Exception (merge {} [])))) + #?(:cljs (is (thrown? js/Error (merge {} [:foo]))) + :clj (is (thrown? java.lang.IllegalArgumentException (merge {} [:foo]))) + :default (is (thrown? Exception (merge {} [:foo])))) (is (= {:foo "foo"} (merge {} [:foo "foo"]))) (is (= {"x" 1} (merge {} ["x" 1]))) (is (= {'x 10, 'y 10} (merge {'x 10} ['y 10]))) (testing "In CLJS (unlike other dialects) vectors with >2 arguments are treated as map-entries (where the latter values are ignored)" #?(:cljs (is (= {:foo :bar} (merge {} [:foo :bar :baz]))), - :clj (is (thrown? java.lang.IllegalArgumentException (merge {} [:foo :bar :baz]))), - :clr (is (thrown? Exception (merge {} [:foo :bar :baz]))))) + :clj (is (thrown? java.lang.IllegalArgumentException (merge {} [:foo :bar :baz]))), + :clr (is (thrown? Exception (merge {} [:foo :bar :baz]))))) (is (= {:foo "foo", :bar "bar"} (merge {} [:foo "foo"] [:bar "bar"]))) (is (= {'x 10, 'y 10, 'z 10} (merge {'x 10} ['y 10] ['z 10]))) (testing "In CLJS (unlike other dialects) vectors with >2 arguments are treated as map-entries (where the latter values are ignored)" #?(:cljs (is (= {:foo :bar} (merge {} [:foo :bar :baz :bar]))), - :clj (is (thrown? java.lang.IllegalArgumentException (merge {} [:foo :bar :baz :bar]))), - :clr (is (thrown? Exception (merge {} [:foo :bar :baz :bar])))))) + :clj (is (thrown? java.lang.IllegalArgumentException (merge {} [:foo :bar :baz :bar]))), + :clr (is (thrown? Exception (merge {} [:foo :bar :baz :bar])))))) (testing "atomic values in position 2+ throw" - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge {} 1))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge {} 1 2))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge {} :foo))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge {} "str")))) + #?@(:cljs [(is (thrown? js/Error (merge {} 1))) + (is (thrown? js/Error (merge {} 1 2))) + (is (thrown? js/Error (merge {} :foo))) + (is (thrown? js/Error (merge {} "str")))] + :default [(is (thrown? Exception (merge {} 1))) + (is (thrown? Exception (merge {} 1 2))) + (is (thrown? Exception (merge {} :foo))) + (is (thrown? Exception (merge {} "str")))])) (testing "undefined `merge` behavior on non-maps" ;; Behavior for non-map input is undefined. We intentionally do not test @@ -83,15 +85,15 @@ (is (any? (merge (first {:a "a"}) {:b "b"} {:c "c"}))) (is (= [:foo] (merge [:foo]))) (is (= :foo (merge :foo))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge :foo :bar))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge 100 :foo))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge "str" :foo))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge nil (range)))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge {} '(1 2)))) - (is (thrown? #?(:cljs :default, :clj Exception, :clr Exception) - (merge {} 1 2))))))) + #?@(:cljs [(is (thrown? js/Error (merge :foo :bar))) + (is (thrown? js/Error (merge 100 :foo))) + (is (thrown? js/Error (merge "str" :foo))) + (is (thrown? js/Error (merge nil (range)))) + (is (thrown? js/Error (merge {} '(1 2)))) + (is (thrown? js/Error (merge {} 1 2)))] + :default [(is (thrown? Exception (merge :foo :bar))) + (is (thrown? Exception (merge 100 :foo))) + (is (thrown? Exception (merge "str" :foo))) + (is (thrown? Exception (merge nil (range)))) + (is (thrown? Exception (merge {} '(1 2)))) + (is (thrown? Exception (merge {} 1 2)))]))))) diff --git a/test/clojure/core_test/val.cljc b/test/clojure/core_test/val.cljc index e931624..0f065e6 100644 --- a/test/clojure/core_test/val.cljc +++ b/test/clojure/core_test/val.cljc @@ -1,5 +1,5 @@ (ns clojure.core-test.val - (:require [clojure.test :as t :refer [deftest testing is are]] + (:require [clojure.test :as t :refer [deftest testing is]] [clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]])) (when-var-exists val @@ -9,29 +9,29 @@ (is (= :v (val (first {:k :v, :one :two})))) ;; Note: the following may be built on shaky ground, per Rich: ;; https://groups.google.com/g/clojure/c/FVcrbHJpCW4/m/Fh7NsX_Yb7sJ - (is (= 'v (val #?(:cljs (cljs.core/MapEntry. 'k 'v nil) - :clj (clojure.lang.MapEntry/create 'k 'v))))) + (is (= 'v (val #?(:cljs (cljs.core/MapEntry. 'k 'v nil) + :default (clojure.lang.MapEntry/create 'k 'v))))) (is (= :b (val (first (sorted-map :a :b))))) (is (= :b (val (first (hash-map :a :b))))) (is (= :b (val (first (array-map :a :b)))))) (testing "`val` throws on lots of things" - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val nil))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val 0))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val '()))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val '(1 2)))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val {}))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val {1 2}))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val []))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val [1 2]))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val #{}))) - (is (thrown? #?(:cljs :default, :clj Exception, :cljr Exception) - (val #{1 2})))))) + #?@(:cljs [(is (thrown? js/Error (val nil))) + (is (thrown? js/Error (val 0))) + (is (thrown? js/Error (val '()))) + (is (thrown? js/Error (val '(1 2)))) + (is (thrown? js/Error (val {}))) + (is (thrown? js/Error (val {1 2}))) + (is (thrown? js/Error (val []))) + (is (thrown? js/Error (val [1 2]))) + (is (thrown? js/Error (val #{}))) + (is (thrown? js/Error (val #{1 2})))] + :default [(is (thrown? Exception (val nil))) + (is (thrown? Exception (val 0))) + (is (thrown? Exception (val '()))) + (is (thrown? Exception (val '(1 2)))) + (is (thrown? Exception (val {}))) + (is (thrown? Exception (val {1 2}))) + (is (thrown? Exception (val []))) + (is (thrown? Exception (val [1 2]))) + (is (thrown? Exception (val #{}))) + (is (thrown? Exception (val #{1 2})))])))) From 97a1f779fa39bb9a8380db89a94e51920f6d6c98 Mon Sep 17 00:00:00 2001 From: Emma Griffin Date: Tue, 9 Sep 2025 18:09:58 -0600 Subject: [PATCH 8/8] Add deps.edn back --- deps.edn | 1 + 1 file changed, 1 insertion(+) create mode 100644 deps.edn diff --git a/deps.edn b/deps.edn new file mode 100644 index 0000000..cb36f2d --- /dev/null +++ b/deps.edn @@ -0,0 +1 @@ +{:paths ["test"]}