Tasks: better error msg for unresolved task
This commit is contained in:
parent
92dde5ce38
commit
fb3d24b23c
2 changed files with 15 additions and 3 deletions
|
|
@ -288,7 +288,7 @@
|
|||
(merge extra-deps (:extra-deps task))
|
||||
(concat requires (:requires task)))
|
||||
[(binding [*out* *err*]
|
||||
(println "No such task:" task-name)) 1])
|
||||
(println "No such task:" t)) 1])
|
||||
(if-let [task (get tasks t)]
|
||||
(let [prog (str prog "\n"
|
||||
(apply str (map deref-task depends))
|
||||
|
|
@ -299,7 +299,7 @@
|
|||
requires (concat requires (:requires task))]
|
||||
[[(format-task init extra-paths extra-deps requires prog)] nil])
|
||||
[(binding [*out* *err*]
|
||||
(println "No such task:" task-name)) 1])))))
|
||||
(println "No such task:" t)) 1])))))
|
||||
[[(format-task
|
||||
init
|
||||
(:extra-paths task)
|
||||
|
|
|
|||
|
|
@ -158,7 +158,19 @@
|
|||
(testing "run"
|
||||
(test-utils/with-config '{:tasks {a (+ 1 2 3)
|
||||
b (prn (run 'a))}}
|
||||
(is (= 6 (bb "run" "b"))))))
|
||||
(is (= 6 (bb "run" "b")))))
|
||||
(testing "no such task"
|
||||
(test-utils/with-config '{:tasks {a (+ 1 2 3)}}
|
||||
(is (thrown-with-msg?
|
||||
Exception #"No such task: b"
|
||||
(bb "run" "b")))))
|
||||
(testing "unresolved dependency"
|
||||
(test-utils/with-config '{:tasks {a (+ 1 2 3)
|
||||
b {:depends [x]
|
||||
:task (+ a 4 5 6)}}}
|
||||
(is (thrown-with-msg?
|
||||
Exception #"No such task: x"
|
||||
(bb "run" "b"))))))
|
||||
|
||||
(deftest list-tasks-test
|
||||
(test-utils/with-config {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue