<< Back to previous view

[CLJ-1391] Allow logical operators on assert expressions Created: 26/Mar/14  Updated: 21/Jul/15  Resolved: 21/Jul/15

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.5
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Sanel Zukan Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: clojure.test


With current code, it is not possible to express logical operators on some clojure.test assert expressions. For example, this will work:

(is (thrown? Exception <some-expression>))

however, here will fail:

(is (not (thrown? Exception <some-expression>)))

since '(thrown?)' is not an ordinary function, but looks like. This also adds confusion which is hard to explain to others unless '(is)' code was shown first.

Also, if the one would like to implement macro (e.g. 'is-not-thrown?') in form:

(defmacro is-not-thrown? [e expr]
  `(is (not ('thrown? ~e ~expr))))

which could be even more confusing for a person not knowing how 'thrown?' is implemented.

Comment by Stuart Halloway [ 21/Jul/15 8:27 AM ]

Agreed that this is not great library design, but doing something better would need to be systematic, not ad hoc.

Generated at Sat Nov 28 16:02:21 CST 2015 using JIRA 4.4#649-r158309.