Konrad Mrożek
2023-08-31 d937545d69736a906fdb549b75bdf2b8e005e287
Handle exit code correctly
1 files modified
15 ■■■■ changed files
clojure/src/test_runner.clj 15 ●●●● patch | view | raw | blame | history
clojure/src/test_runner.clj
@@ -104,10 +104,14 @@
          (System/exit
           (if (pos? (if (and -test-file -test-line)
                       (let [results (t/run-test-var (find-closest-test (.. (java.io.File. -test-file) getAbsolutePath)
                                                                        (parse-long -test-line)))]
                         (+ (:fail results 0)
                            (:error results 0)))
                       (if-let [test-var (find-closest-test (.. (java.io.File. -test-file) getAbsolutePath)
                                                            (parse-long -test-line))]
                         (->> (t/run-test-var test-var)
                              ((juxt :fail :error))
                              (apply +))
                         (do
                           (println "No test found")
                           0))
                       (reduce (fn [total-fails n]
                                 (let [results (t/run-tests n)]
                                   (+ total-fails
@@ -117,6 +121,3 @@
                               test-namespaces)))
             1
             0)))))))