[Haskell-cafe] Letting the darcs test fail, if QuickCheck tests fail

Henning Thielemann lemming at henning-thielemann.de
Sun Nov 18 06:55:21 EST 2007


On Tue, 30 Oct 2007, David Roundy wrote:

> On Tue, Oct 30, 2007 at 05:24:21PM +0100, Henning Thielemann wrote:
> > When following the description on
> >  http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program#Add_some_automated_testing:_QuickCheck
> >   then darcs will run the QuickCheck tests on each 'darcs record', but the
> > new patch is also accepted by darcs if one of the tests fail. What is the
> > most simple way to let 'darcs record' fail, when a QuickCheck test fails?
>
> You can do this with QuickCheck 2 using quickCheck', but I don't know how
> to do this with QuickCheck 1.  xmonad uses a function "mytests", which I
> guess is pretty much copied from the code of QuickCheck 1, with tracking of
> errors added in.  It's ugly, but it's only a few dozen lines.
>
> Another option would be to grep the output of the test suite to look for
> failure.

I didn't want to introduce the dependency on QuickCheck2 just for
quickCheck', so I went for the 'grep' solution. I also added your hints to
  http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program#Running_the_test_suite_from_darcs

Admittedly, the grep solution will be certainly restricted to Unix. Even
more I became aware, that grepping for 'Falsifiable' only catches
unsatisfied tests, but if a test fails with 'error' this slips through.
I could add some handling for this case, but I feel that I'm missing
something, again.


More information about the Haskell-Cafe mailing list