This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-14
Channels
- # announcements (3)
- # asami (22)
- # babashka (9)
- # beginners (92)
- # calva (7)
- # clj-kondo (8)
- # clojure (61)
- # clojure-australia (3)
- # clojure-boston (1)
- # clojure-dev (3)
- # clojure-europe (24)
- # clojure-nl (3)
- # clojure-spec (4)
- # clojure-uk (14)
- # clojurescript (5)
- # conjure (12)
- # core-async (44)
- # cryogen (8)
- # crypto (2)
- # cursive (24)
- # data-science (5)
- # events (1)
- # fulcro (10)
- # garden (2)
- # graalvm (19)
- # helix (4)
- # instaparse (13)
- # lsp (13)
- # luminus (1)
- # malli (5)
- # meander (22)
- # off-topic (22)
- # polylith (8)
- # re-frame (69)
- # react (1)
- # reagent (2)
- # releases (2)
- # shadow-cljs (52)
- # sql (7)
- # test-check (3)
- # timbre (2)
- # tools-deps (9)
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))))
@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?
@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.