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
|
||||
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
(write
|
||||
{"status" ["done"]
|
||||
"id" id
|
||||
"value" "nil"})
|
||||
"value" (write-fn nil)})
|
||||
pod.test-pod/reader-tag
|
||||
(write
|
||||
{"status" ["done"]
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue