Closed falsifian closed 5 months ago
If your goal is to inspect the result of running quickCheck
on a Property
you can use quickCheckResult
to obtain the Result
that contains the information you're looking for in your final two paragraphs.
As for combinators for saying when you expect a property to fail, well that's really a case of writing your property so that it succeeds in those cases...
(Sorry, this would be more appropriate as a discussion forum post, but I couldn't find a forum for QuickCheck.)
I have implemented a new function returning
Property
and would like to test it. Some of my tests should assert that theProperty
fails in certain circumstances. Is there a way to do that?expectFailure
doesn't do what I want. For example,testProperty "XXX" (\ x y -> expectFailure (x == (y::Int)))
passes, because x=y=0 is a counterexample for x==y. The combinator I'm looking for would cause that test to fail, becausex == y
does not always fail.The implementation of
Property
is hidden, and I couldn't find any functions that inspect aProperty
in a way that would let me do what I want. Ideally I'd like to be able to inspect both the counterexample and whether theProperty
succeeded or not.EDIT: By "counterexample" I mean the counterexample string. I'd like to check that it includes relevant values as a substring, to help the user figure out what went wrong.