diff --git a/script/test b/script/test index 6aab3b3..e50850e 100755 --- a/script/test +++ b/script/test @@ -1,7 +1,11 @@ #!/usr/bin/env bash +# format = edn +clojure -A:test -n babashka.pods.jvm-test +clojure -A:sci:test -n babashka.pods.sci-test + +# format = json +export BABASHKA_POD_TEST_FORMAT +BABASHKA_POD_TEST_FORMAT=json clojure -A:test -n babashka.pods.jvm-test -#clojure -A:test:kaocha --focus babashka.pods.jvm-test - clojure -A:sci:test -n babashka.pods.sci-test -#clojure -A:sci:test:kaocha --focus babashka.pods.sci-test diff --git a/test-pod/pod/test_pod.clj b/test-pod/pod/test_pod.clj index 219cc86..5bb84d5 100644 --- a/test-pod/pod/test_pod.clj +++ b/test-pod/pod/test_pod.clj @@ -153,7 +153,7 @@ (write {"status" ["done"] "id" id - "value" "nil"}) + "value" (write-fn nil)}) pod.test-pod/reader-tag (write {"status" ["done"] diff --git a/test-resources/test_program.clj b/test-resources/test_program.clj index 3ed37db..a6a534f 100644 --- a/test-resources/test_program.clj +++ b/test-resources/test_program.clj @@ -1,5 +1,10 @@ (require '[babashka.pods :as pods]) -(def pod-id (:pod/id (pods/load-pod ["clojure" "-A:test-pod"]))) + +(def fmt (or (System/getenv "BABASHKA_POD_TEST_FORMAT") + "edn")) + +(def pod-id (:pod/id (pods/load-pod (cond-> ["clojure" "-A:test-pod"] + (= "json" fmt) (conj "--json"))))) (require '[pod.test-pod :as pod]) (def pod-ns-name (ns-name (find-ns 'pod.test-pod))) @@ -43,8 +48,14 @@ (def x9 pod.test-pod/x9) -(def tagged (pod/reader-tag)) -(def other-tagged (pod/other-tag)) +(def tagged (if (= "edn" fmt) + (pod/reader-tag) + [1 2 3])) + +(def other-tagged + (if (= "edn" fmt) + (pod/other-tag) + [[1] [1]])) (def fn-called (pod.test-pod/fn-call inc 2)) diff --git a/test/babashka/pods/sci_test.clj b/test/babashka/pods/sci_test.clj index e7c4826..1096af0 100644 --- a/test/babashka/pods/sci_test.clj +++ b/test/babashka/pods/sci_test.clj @@ -14,5 +14,6 @@ {:namespaces {'babashka.pods {'load-pod pods/load-pod 'invoke pods/invoke - 'unload-pod pods/unload-pod}}}))] + 'unload-pod pods/unload-pod}} + :classes {'System System}}))] (assertions out err ret))) diff --git a/test/babashka/pods/test_common.clj b/test/babashka/pods/test_common.clj index 1a28e32..6012d6d 100644 --- a/test/babashka/pods/test_common.clj +++ b/test/babashka/pods/test_common.clj @@ -12,7 +12,7 @@ 6 3 [1 2 3 4 5 6 7 8 9] - "Illegal arguments / {:args (1 2 3)}" + #"Illegal arguments / \{:args [\(\[]1 2 3[\)\]]\}" nil 3 #"cast"