aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStuart Sierra <mail@stuartsierra.com>2009-02-11 01:51:15 +0000
committerStuart Sierra <mail@stuartsierra.com>2009-02-11 01:51:15 +0000
commit3115ac5b558d322b4c3a2fc4b0bae61d22ca4a5e (patch)
tree710975f13b70f34b08fbd9af162a221b1caa5061 /src
parentaeaaf08c691ded016bafa47286ce094e53fa624f (diff)
test_is.clj: Print complete stack trace for exceptions.
Bind *stack-trace-depth* to a number to limit stack trace depth. Discussion at http://groups.google.com/group/clojure/browse_thread/thread/5316bdb93f1c4407
Diffstat (limited to 'src')
-rw-r--r--src/clojure/contrib/test_is.clj7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/clojure/contrib/test_is.clj b/src/clojure/contrib/test_is.clj
index 6b14ecc0..aac934be 100644
--- a/src/clojure/contrib/test_is.clj
+++ b/src/clojure/contrib/test_is.clj
@@ -206,6 +206,11 @@
tests when compiling or loading production code."}
*load-tests* true)
+(def
+ #^{:doc "The maximum depth of stack traces to print when an Exception
+ is thrown during a test. Defaults to nil, which means print the
+ complete stack trace."}
+ *stack-trace-depth* nil)
;;; GLOBALS USED BY THE REPORTING FUNCTIONS
@@ -296,7 +301,7 @@
(println "expected:" (pr-str expected))
(print " actual: ")
(if (instance? Throwable actual)
- (stack/print-cause-trace actual 5)
+ (stack/print-cause-trace actual *stack-trace-depth*)
(prn actual)))