Skip to content

Commit

Permalink
Reload clojure.test after hooking clojure.stack functions
Browse files Browse the repository at this point in the history
Fixes #42
  • Loading branch information
hlship committed Apr 15, 2016
1 parent a6b3387 commit 9bfbd1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/io/aviso/repl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
(:require [clojure
[main :as main]
[repl :as repl]
[stacktrace :as st]]))
[stacktrace :as st]])
(:import [clojure.lang RT]))

(defn- reset-var!
[v override]
Expand Down Expand Up @@ -61,5 +62,9 @@
(reset-var! #'st/print-stack-trace pretty-print-stack-trace)
(reset-var! #'st/print-cause-trace pretty-print-stack-trace)

;; This is necessary for Clojure 1.8 and above, due to direct linking
;; (from clojure.test to clojure.stacktrace).
(RT/loadResourceScript "clojure/test.clj")

(Thread/setDefaultUncaughtExceptionHandler (uncaught-exception-handler))
nil)
nil)
4 changes: 4 additions & 0 deletions test/demo.clj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
(throw (RuntimeException. "Boom!"))
(countdown (dec n))))

(defn test-failure
[]
(report {:type :error :expected nil :actual (make-ex-info)}))

(comment

;; 11 Feb 2016 - 553 µs (14 µs std dev) - Clojure 1.8
Expand Down

0 comments on commit 9bfbd1e

Please sign in to comment.