Run the project's tests. Accepts a list of namespaces for which to run all
tests. If none are given, runs them all.
(defn test
"Run the project's tests. Accepts a list of namespaces for which to run all
tests. If none are given, runs them all."
[project & namespaces]
(let [namespaces (if (empty? namespaces)
(sort (find-namespaces-in-dir (file (:test-path project))))
(map symbol namespaces))
result (java.io.File/createTempFile "lein" "result")]
(eval-in-project project
(with-version-guard
(form-for-testing-namespaces namespaces
(.getAbsolutePath result))))
(if (and (.exists result) (pos? (.length result)))
(let [summary (read-string (slurp (.getAbsolutePath result)))
success? (zero? (+ (:error summary) (:fail summary)))]
(.delete result)
(if success? 0 1))
1)))
Comments top
No comments for test. Log in to add a comment.