-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds compatibility with babashka. Fixes #302. Notes: - To make malli work well with bb, the :bb reader conditionals rely less on internal details of Clojure and use core functions instead, similar to what happens in :cljs branches. As discussed with @puredanger, I didn't add LazilyPersistentVector to bb as that was too far off from what is considered a public API. - Upgraded borkdude/dynaload which was made compatible with bb - Add bb test runner to ensure no breakage happens with future changes to malli - The evaluation part is implemented by just using load-string in bb, since SCI itself isn't exposed yet (might happen in the future). SCI also has eval-form which lets you skip the string parsing bit, that might be more performant, but we can address that in a future PR.
- Loading branch information
Showing
11 changed files
with
168 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{:deps {current/deps {:local/root "."}} | ||
:tasks | ||
{test-clj {:doc "Run JVM Clojure tests with kaocha" | ||
:task (apply clojure (str "-A:" (System/getenv "CLOJURE")) | ||
"-M:test" "-m" "kaocha.runner" *command-line-args*)} | ||
|
||
test-cljs {:doc "Run ClojureScript tests" | ||
:task (do | ||
(println "Running CLJS tests without optimizations") | ||
(apply clojure "-M:test:cljs-test-runner" "-c" "{:optimizations :none, :preloads [sci.core]}" | ||
*command-line-args*) | ||
(println "Running CLJS tests with optimizations advanced") | ||
(apply clojure "-M:test:cljs-test-runner" "-c" "{:optimizations :none, :preloads [sci.core]}" | ||
*command-line-args*))} | ||
|
||
test-bb {:doc "Run Babashka tests" | ||
:extra-deps {org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha" | ||
:git/sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}} | ||
:extra-paths ["src" "test"] | ||
:task bb-test-runner/run-tests}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(ns bb-test-runner | ||
(:require | ||
[clojure.test :as t] | ||
[malli.clj-kondo-test] | ||
[malli.core-test] | ||
[malli.destructure-test] | ||
[malli.dot-test] | ||
[malli.error-test] | ||
[malli.experimental-test] | ||
[malli.generator-test] | ||
[malli.instrument-test] | ||
[malli.json-schema-test] | ||
[malli.plantuml-test] | ||
[malli.provider-test] | ||
[malli.registry-test] | ||
[malli.swagger-test] | ||
[malli.transform-test] | ||
[malli.util-test])) | ||
|
||
(defn run-tests [& _args] | ||
(let [{:keys [fail error]} | ||
(t/run-tests | ||
'malli.core-test | ||
'malli.clj-kondo-test | ||
'malli.destructure-test | ||
'malli.dot-test | ||
'malli.error-test | ||
'malli.experimental-test | ||
'malli.instrument-test | ||
'malli.json-schema-test | ||
;; 'malli.generator-test ;; skipped for now due to test.chuck incompatibility | ||
'malli.plantuml-test | ||
'malli.provider-test | ||
'malli.registry-test | ||
'malli.swagger-test | ||
'malli.transform-test | ||
'malli.util-test)] | ||
(when (or (pos? fail) | ||
(pos? error)) | ||
(System/exit 1)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters