Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Test by
recategorized by

I have a problem with is in clojure.test . Is there an is-not I can use? If I simply test (is (not ...)) then the failure messages are uninformative. If (is (> a b)) fails, I get a message like (not (> 1 2) but when (is (not (> a b))) fails I just get a message (not (not true)) . Certainly for > I could choose a better predicate for the test, but in general (is (f a ...)) vs (is (not (f a ...))) is problematic.

1 Answer

+1 vote
by

Not built in, but the is predicates are an open extensible system (docs at https://clojure.github.io/clojure/#clojure.test):

(defmethod clojure.test/assert-expr 'not [form]
  ...)

Basically you need to determine how to do-report in true / false cases to yield what you like. This probably would take a bit of futzing around, but you'd want to look at something like https://clojure.github.io/clojure/clojure.test-api.html#clojure.test/assert-predicate, which is where that current message is created.

...