If an Exception is thrown during test execution, the filename and line number are frequently not helpful for finding the problem. For instance, this code:
`
(require '[clojure.test :refer [deftest test-var]])
(deftest foo
(meta))
(test-var #'foo)
`
Will output an error at AFn.java:429.
`
ERROR in (foo) (AFn.java:429)
Uncaught exception, not in assertion.
expected: nil
actual: clojure.lang.ArityException: Wrong number of args (0) passed to: core/meta--4144
at clojure.lang.AFn.throwArity (AFn.java:429)
clojure.lang.AFn.invoke (AFn.java:28)
user/fn (error_reporting.clj:4)
clojure.test$test_var$fn__7670.invoke (test.clj:704)
clojure.test$test_var.invoke (test.clj:704)
user$eval6.invoke (error_reporting.clj:6)
clojure.lang.Compiler.eval (Compiler.java:6782)
...etc
`
(link: http://dev.clojure.org/jira/browse/CLJ-377?focusedCommentId=24016&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-24016 text: Rich's Comment 24016 on CLJ-377) says that he thinks the message should report the test file line rather than where the exception was thrown.
Approach: Filter the stacktrace class prefix {{clojure.lang.AFn}} from the top of error stacktraces.
After applying the patch, the above example outputs error_reporting.clj:4:
`
ERROR in (foo) (error_reporting.clj:4)
Uncaught exception, not in assertion.
expected: nil
actual: clojure.lang.ArityException: Wrong number of args (0) passed to: core/meta--4141
at clojure.lang.AFn.throwArity (AFn.java:429)
clojure.lang.AFn.invoke (AFn.java:28)
user$fn__3.invokeStatic (error_reporting.clj:4)
user/fn (error_reporting.clj:3)
clojure.test$test_var$fn__114.invoke (test.clj:705)
clojure.test$test_var.invokeStatic (test.clj:705)
clojure.test$test_var.invoke (test.clj:-1)
user$eval6.invokeStatic (error_reporting.clj:6)
user$eval6.invoke (error_reporting.clj:-1)
clojure.lang.Compiler.eval (Compiler.java:6939)
...etc
`
Patch: clj-1811.patch