Fix #1451: Allow passing explicit file and line number to clojure.test

This commit is contained in:
Matthew Downey 2022-12-20 13:41:36 -05:00 committed by GitHub
parent d9aad85476
commit 62916fa292
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -297,7 +297,7 @@
current assertion."
{:added "1.1"}
[m]
(let [{:keys [:file :line]} (meta (first @testing-vars))]
(let [{:keys [:file :line]} (merge m (meta (first @testing-vars)))]
(str
;; Uncomment to include namespace in failure report:
;;(ns-name (:ns (meta (first *testing-vars*)))) "/ "

View file

@ -112,3 +112,9 @@
(deftest line-number-test
(is (str/includes? (bb "test-resources/line_number_test_test.clj")
"line_number_test_test.clj:4")))
(deftest testing-vars-str-test
(is (str/includes?
(bb "(clojure.test/testing-vars-str {:file \"x\" :line 1})")
"() (x:1)")
"includes explicit line number + file name in test report"))