[QuickCheck] Test of type Property doesn't report counter example
Nick Smallbone
nicsma at chalmers.se
Sat Apr 26 14:40:11 BST 2014
Hi Lennart,
Thanks for the bug report. This is a regression in 2.7 that appeared
when we changed Property from a type synonym to a newtype. I've pushed
a patch to fix it which should be on Hackage in a few days.
Nick
On Friday 25 April, 2014 at 11:47 pm, Lennart Kolmodin wrote:
> Hi,
>
> I ran into an issue where a test that fails with an exception does not
> report the input given to that test.
>
> As an example, see this simple test;
>
> quickCheck $ \x -> if (x == 10) then error "oh noes" else property True
>
> This test either succeeds;
> +++ OK, passed 100 tests.
> or fails;
> *** Failed! Exception: 'oh noes' (after 32 tests):
>
> Notice the lack of the counter example!
>
> Now if we change the test slightly, and make it Bool instead of Property;
>
> quickCheck $ \x -> if (x == 10) then error "oh noes" else True
>
> It either succeeds or fails with;
> *** Failed! Exception: 'oh noes' (after 11 tests):
> 10
>
> Aha! The counter example is given!
>
> If we don't throw an exception but rather just fail the test with False;
>
> quickCheck $ \x -> if (x == 10) then False else True
> or
> quickCheck $ \x -> if (x == 10) then property False else property True
>
> The both succeed or fail with counter examples.
>
> It looks to me that tests of type Property which fails with an exception
> doesn't give a counter example. It look useful to me if it gave a counter
> example also in this case.
>
> Regards,
> Lennart
> _______________________________________________
> QuickCheck mailing list
> QuickCheck at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/quickcheck
More information about the QuickCheck
mailing list