-
Notifications
You must be signed in to change notification settings - Fork 129
Compound checkers
marick edited this page Apr 26, 2012
·
5 revisions
These checkers are available beginning with Midje 1.4.
If you want to make more than one check per checker, use one of the two compound checkers. The first, every-checker
, passes only if all of its constituent checkers pass:
(fact
4 => (every-checker odd? (roughly 3)))
That fact will fail like this:
FAIL at (t_combining.clj:103)
Actual result did not agree with the checking function.
Actual result: 4
Checking function: (every-checker odd? (roughly 3))
During checking, these intermediate values were seen:
odd? => false
Notice that every-checker
prints which of the checkers failed. every-checker
stops checking after the first checker fails.
The second function, some-checker
, fails only if all of its constituent checkers fail. If any succeeds, some-checker
stops checking and succeeds itself.
(fact
4 => (some-checker odd? (roughly 3)))