exec tests
This commit is contained in:
parent
7b563dd802
commit
42ebb92c5d
2 changed files with 23 additions and 2 deletions
7
test-resources/babashka/exec_test.clj
Normal file
7
test-resources/babashka/exec_test.clj
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
(ns babashka.exec-test
|
||||||
|
{:org.babashka/cli {:coerce {:foo []}}})
|
||||||
|
|
||||||
|
(defn exec-test
|
||||||
|
{:org.babashka/cli {:coerce {:bar :keyword}}}
|
||||||
|
[m]
|
||||||
|
(prn m))
|
||||||
|
|
@ -15,8 +15,22 @@
|
||||||
(edn/read-string
|
(edn/read-string
|
||||||
(bb "-x" "cheshire.core/generate-string" "--foo" "1")) true))))
|
(bb "-x" "cheshire.core/generate-string" "--foo" "1")) true))))
|
||||||
|
|
||||||
(deftest tag-test
|
(deftest tasks-exec-test
|
||||||
(u/with-config
|
(u/with-config
|
||||||
"{:deps {}
|
"{:deps {}
|
||||||
:tasks {foo (exec 'clojure.core/prn)}}"
|
:tasks {foo (exec 'clojure.core/prn)}}"
|
||||||
(is (= {:dude 1} (edn/read-string (bb "run" "foo" "--dude" "1"))))))
|
(is (= {:dude 1} (edn/read-string (bb "run" "foo" "--dude" "1")))))
|
||||||
|
(u/with-config
|
||||||
|
"{:deps {}
|
||||||
|
:tasks {foo (exec 'clojure.core/prn)}}"
|
||||||
|
(is (= {:dude 1} (edn/read-string (bb "run" "foo" "--dude" "1")))))
|
||||||
|
(u/with-config
|
||||||
|
"{:deps {}
|
||||||
|
:tasks {foo {:org.babashka/cli {:coerce {:dude []}}
|
||||||
|
:task (exec 'clojure.core/prn)}}}"
|
||||||
|
(is (= {:dude [1]} (edn/read-string (bb "run" "foo" "--dude" "1")))))
|
||||||
|
(u/with-config
|
||||||
|
"{:deps {}
|
||||||
|
:tasks {foo {:task (exec 'babashka.exec-test/exec-test)}}}"
|
||||||
|
(is (= {:foo [1], :bar :yeah}
|
||||||
|
(edn/read-string (bb "-cp" "test-resources" "run" "foo" "--foo" "1" "--bar" "yeah"))))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue