gfredericks / test.chuck

A utility library for test.check
Eclipse Public License 1.0
215 stars 26 forks source link

add basic assertions to clojure test integration #8

Closed tcrayford closed 6 years ago

tcrayford commented 9 years ago

because the clojure.test integration uses varargs in a macro, it's pretty easy to forget an argument and get a weird error message out like this:

<CompilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol, compiling:(yeller/unit/deploys_test.clj:27:3)>

Better to just assert on the arguments and spit out detailed errors.

gfredericks commented 9 years ago

I like checking the name and bindings; I'm less sure about the non-empty body.

It's similar to the fact that the prop/for-all macro forces you to have an expression in the body ((prop/for-all [x gen-int]) is a compile error), which leads me to type :STUB an awful lot. Most of the rest of the clojure ecosystem isn't like this.

A funny middle-ground would be to have the macro insert a failing assertion if your body is empty :).

tcrayford commented 9 years ago

I'm down with removing that check. I'll push a commit here later.

nberger commented 8 years ago

ping @tcrayford, I'd really like this to be merged :)

gfredericks commented 8 years ago

hey this could be done more robustly with clojure.spec now