From da9b38aaa2c2d88a725e31ac660f5ef7587a00a2 Mon Sep 17 00:00:00 2001 From: Stuart Sierra Date: Tue, 16 Dec 2008 15:32:16 +0000 Subject: test_is.clj: fix to catch exceptions outside of "is" assertions. Thanks to Allen Rohner for report. --- src/clojure/contrib/test_is.clj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/clojure') diff --git a/src/clojure/contrib/test_is.clj b/src/clojure/contrib/test_is.clj index eb0b4daa..02adbae8 100644 --- a/src/clojure/contrib/test_is.clj +++ b/src/clojure/contrib/test_is.clj @@ -106,7 +106,7 @@ (defmethod report :error [event msg expected actual] (report-count :error) - (println "\nERROR in" *test-name* msg) + (println "\nERROR in" *test-name*) (when msg (println msg)) (println "expected:" (pr-str expected)) (println " actual:" (pr-str actual))) @@ -230,7 +230,10 @@ (when-let [t (:test (meta v))] (binding [*test-name* (str v)] (report-count :test) - (t)))) + (try (t) + (catch Throwable e + (report :error "Uncaught exception, not in assertion." + nil e)))))) (defn test-ns "Tests all vars in the namespace. Returns a map of counts -- cgit v1.2.3-70-g09d2