Implement tests for JSON
This commit is contained in:
parent
0ecf6d6d40
commit
6fc595392e
5 changed files with 25 additions and 9 deletions
10
script/test
10
script/test
|
|
@ -1,7 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/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 -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 -n babashka.pods.sci-test
|
||||||
#clojure -A:sci:test:kaocha --focus babashka.pods.sci-test
|
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@
|
||||||
(write
|
(write
|
||||||
{"status" ["done"]
|
{"status" ["done"]
|
||||||
"id" id
|
"id" id
|
||||||
"value" "nil"})
|
"value" (write-fn nil)})
|
||||||
pod.test-pod/reader-tag
|
pod.test-pod/reader-tag
|
||||||
(write
|
(write
|
||||||
{"status" ["done"]
|
{"status" ["done"]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
(require '[babashka.pods :as pods])
|
(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])
|
(require '[pod.test-pod :as pod])
|
||||||
(def pod-ns-name (ns-name (find-ns 'pod.test-pod)))
|
(def pod-ns-name (ns-name (find-ns 'pod.test-pod)))
|
||||||
|
|
||||||
|
|
@ -43,8 +48,14 @@
|
||||||
|
|
||||||
(def x9 pod.test-pod/x9)
|
(def x9 pod.test-pod/x9)
|
||||||
|
|
||||||
(def tagged (pod/reader-tag))
|
(def tagged (if (= "edn" fmt)
|
||||||
(def other-tagged (pod/other-tag))
|
(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))
|
(def fn-called (pod.test-pod/fn-call inc 2))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,6 @@
|
||||||
{:namespaces {'babashka.pods
|
{:namespaces {'babashka.pods
|
||||||
{'load-pod pods/load-pod
|
{'load-pod pods/load-pod
|
||||||
'invoke pods/invoke
|
'invoke pods/invoke
|
||||||
'unload-pod pods/unload-pod}}}))]
|
'unload-pod pods/unload-pod}}
|
||||||
|
:classes {'System System}}))]
|
||||||
(assertions out err ret)))
|
(assertions out err ret)))
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
6
|
6
|
||||||
3
|
3
|
||||||
[1 2 3 4 5 6 7 8 9]
|
[1 2 3 4 5 6 7 8 9]
|
||||||
"Illegal arguments / {:args (1 2 3)}"
|
#"Illegal arguments / \{:args [\(\[]1 2 3[\)\]]\}"
|
||||||
nil
|
nil
|
||||||
3
|
3
|
||||||
#"cast"
|
#"cast"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue