This commit is contained in:
Michiel Borkent 2021-03-20 14:17:02 +01:00
parent f9f6fa8621
commit ff3d1e56ba

View file

@ -48,7 +48,7 @@
(let [res (bb :all)] (let [res (bb :all)]
(is (= 6 res))) (is (= 6 res)))
(is (not (fs/exists? temp-file)))))) (is (not (fs/exists? temp-file))))))
(testing ":or-do" (testing ":and-do failing"
(with-config {:tasks {:div-by-zero {:task/type :babashka (with-config {:tasks {:div-by-zero {:task/type :babashka
:args ["-e" "(/ 1 0)"]} :args ["-e" "(/ 1 0)"]}
:sum {:task/type :babashka :sum {:task/type :babashka
@ -56,4 +56,12 @@
:all {:task/type :babashka :all {:task/type :babashka
:args [:do :div-by-zero :and-do :sum]}}} :args [:do :div-by-zero :and-do :sum]}}}
(is (thrown-with-msg? Exception #"Divide" (is (thrown-with-msg? Exception #"Divide"
(bb :all)))))) (bb :all)))))
(testing ":or-do succeeding"
(with-config {:tasks {:div-by-zero {:task/type :babashka
:args ["-e" "(/ 1 0)"]}
:sum {:task/type :babashka
:args ["-e" "(+ 1 2 3)"]}
:all {:task/type :babashka
:args [:do :div-by-zero :or-do :sum]}}}
(is (= 6 (bb :all))))))