Weired output when using newlines in error messages

Simon Hengel sol at typeful.net
Wed Jan 25 11:23:46 GMT 2012


Hi Nick,
thanks for your quick reply.

> What happens is that QuickCheck prints the error reason when it first
> finds a counterexample, then starts shrinking. Whenever it
> successfully shrinks the counterexample, it backspaces over the old
> reason to erase it and then prints the new reason.

Out of curiosity, what is the purpose of printing the intermediate
values while shrinking.

> I've pushed a couple of patches that fix this: during shrinking, the
> message is squeezed to fit on one line, and at the end the whole error
> message is printed in full. (Single-line error messages are printed as
> part of the "*** Failed!" line, as before, but multi-line error
> messages are printed separately.)

Works like a charm.  Thanks for that!

> You might also like the printTestCase function. It includes a string
> as part of the counterexample when a property fails. It copes fine
> with newlines, and QuickCheck won't meddle with the formatting.

Nice, looks like this is more appropriate than using `failed` directly.
Is there something like that for monadic properties (`fail` seems to be
analogous to `failed`).

Cheers,
Simon



More information about the QuickCheck mailing list