Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test reporting fails over non-string assertion message in clojure.test/is #2962

Open
WBSemple opened this issue Sep 18, 2024 · 0 comments
Open

Comments

@WBSemple
Copy link

Any failing clojure.test/is assertions where non-string objects are passed in the second argument will cause the test run to fall over with a ClassCastException (it appears to retry several times).

To reporduce, run the following test with Run Test Under Caret in REPL or Run Tests in Current NS in REPL. It will break on the third assertion; gutter icons will appear for the first two assertions, but nothing after.

(deftest my-test
  (is false "msg")
  (is true {:hello "there"})
  (is false {:hello "again"}) ;; breaks here
  (is true))

It would be great if cursive could handle this more gracefully as it can be quite awkward in projects where this is commonplace.

My current workaround is to hijack clojure.test/assert-expr and add a pr-str to msg:

(defonce assert-expr* assert-expr)
(.bindRoot (var assert-expr) (fn [msg form] (assert-expr* (pr-str msg) form)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant