Fix #1189: add test for error message for clojure {:dir "missing-directory"} (#1543)

* add test for error message from running clojure
task in non-existent dir

* make testing string more accurate
This commit is contained in:
Bob 2023-04-22 17:37:17 -04:00 committed by GitHub
parent 4cbdb57ad1
commit 39e4ea71e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -316,7 +316,13 @@
;; can't properly test this, but `(clojure)` should work with zero args
#_(test-utils/with-config
(pr-str '{:tasks {foo (-> (clojure) :out prn)}})
(is (str/includes? (test-utils/bb "(+ 1 2 3)" "run" "foo") "6")))))
(is (str/includes? (test-utils/bb "(+ 1 2 3)" "run" "foo") "6"))))
(testing "call to run in missing dir gives 'cannot run program' message"
(test-utils/with-config
(pr-str '{:tasks {foo (clojure {:dir "../missingdir"} "-M" "-r")}})
; check rough text of error message, specific message about missing directory is OS-dependent
(is (thrown-with-msg? Exception #"Cannot run program .* \(in directory \"\.\.[/\\]missingdir\"\)"
(bb "run" "foo"))))))
(deftest list-tasks-test
(test-utils/with-config {}