| | |
| | | |
| | | (defmulti emacs-report :type) |
| | | |
| | | (defmethod emacs-report :pass |
| | | (defmethod emacs-report :fail |
| | | [m] |
| | | (t/with-test-out |
| | | (println "PASS:"))) |
| | | (when-let [source-file (some-> t/*testing-vars* |
| | | first |
| | | meta |
| | | :file)] |
| | | (println (str "FAIL:" source-file ":" (:line m) ":" (t/testing-vars-str m) ":" (t/testing-contexts-str) ":" (:message m "FAIL")))))) |
| | | |
| | | (defmethod emacs-report :error |
| | | [m] |
| | | (when-let [source-file (some-> t/*testing-vars* |
| | | first |
| | | meta |
| | | :file)] |
| | | (println (str "ERROR:" source-file ":" (:line m) ":" (t/testing-vars-str m) ":" (t/testing-contexts-str) ":" (:message m "FAIL"))))) |
| | | |
| | | (defmethod emacs-report :default |
| | | [_]) |
| | | |
| | | (defn -main [& [test-file]] |
| | | (binding [*compile-files* true] |
| | |
| | | (map load-file) |
| | | (map (comp :ns meta)) |
| | | (into #{}))] |
| | | (run! (fn [n] (t/run-tests n)) test-namespaces)))) |
| | | (System/exit (if (pos? (reduce (fn [total-fails n] |
| | | (with-redefs [t/report emacs-report] |
| | | (let [results (t/run-tests n)] |
| | | (+ total-fails |
| | | (:fail results 0) |
| | | (:error results 0))))) |
| | | 0 |
| | | test-namespaces)) |
| | | 1 |
| | | 0))))) |