test-check

2021-06-14T00:22:35.002800Z

I noticed a difference in using the for-all and checking forms available in com.gfredericks.test.chuck.clojure-test, seems that for-all will give one assertion error on the shrunk result where checking will give one for each failing is. Is that expected? I was hoping for-all would give the same kind of reporting.

(defspec test-test
  (for-all [x (gen/return 1)]
    (is (zero? x))))

(deftest test-test
  (checking "fails" 1 [x (gen/return 1)]
    (is (zero? x)))) 

seancorfield 2021-06-14T00:41:03.005700Z

@colinkahn It’s expected: for-all is a single assertion — that the property holds for all values tested — so it will either pass or fail as a whole: is just checks the expression; checking runs the whole body it is passed — which can contain any number of assertions — and in that context each is runs as a regular assertion. Does that help?

1❤️
2021-06-14T00:49:39.011100Z

@seancorfield I knew for-all in test.check worked that way but figured the test.chuck one wasn't limited to a single assertion and would report them all. https://github.com/gfredericks/test.chuck#alternate-clojuretest-integration It is just a minor inconvenience if that's the case though, I like the fact that I can get the :smallest from the return of defspec in the REPL, but also wanted the reporting available in checking.