diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2008-12-16 15:32:16 +0000 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2008-12-16 15:32:16 +0000 |
commit | da9b38aaa2c2d88a725e31ac660f5ef7587a00a2 (patch) | |
tree | 2ff87aa86e9d16f0412af24cd14586c7dfc9f1cb /src/clojure | |
parent | 5e0ebee315551ad59470219287da4ec0bc7995ca (diff) |
test_is.clj: fix to catch exceptions outside of "is" assertions.
Thanks to Allen Rohner for report.
Diffstat (limited to 'src/clojure')
-rw-r--r-- | src/clojure/contrib/test_is.clj | 7 |
1 files changed, 5 insertions, 2 deletions
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 |