[Haskell-cafe] packages and QuickCheck

Conal Elliott conal at conal.net
Tue Sep 9 10:05:24 EDT 2008

Thanks, Sean.

On Tue, Sep 9, 2008 at 3:46 PM, Sean Leather <leather at cs.uu.nl> wrote:

> How do folks like to package up QuickCheck tests for their libraries?  In
>> the main library?  As a separate repo & package?  Same repo & separate
>> package?  Keeping tests with the tested code allows testing of non-exported
>> functionality, but can add quite a lot of clutter.
> I have QuickCheck properties plus HUnit tests, but I think the question is
> the same. For me, it's in the same repository and shipped with the package
> source. I think that if you ship source (even via Hackage), you should also
> ship tests. So, if somebody wants to modify the source, they can run the
> tests. And making it convenient to test is very important, so I have "cabal
> test" (or "runhaskell Setup.hs test" without cabal-install) configured to
> run the tests. I don't think tests should (in general) be part of the
> user-visible API, so I have them external to the module hierarchy.

How do you set up cabal to do these tests?

Do your libraries depend on HUnit?

Where do you like to place your tests?  In the functionality modules?  A
parallel structure?  A single Test.hs file somewhere?

Testing non-exported functionality without exporting the test interface
> seems difficult in general. Is there a way to hide part of a module
> interface with Cabal? Then, you could have a 'test' function exported from
> each module for testing but hidden for release.

My current leaning is to split a package "foo" into packages "foo" and
>> "foo-test"
> What benefit does this provide?

It keeps the library and its dependencies small.  Probably some of the
alternatives do as well.  For testing, I'm using
checkers<http://haskell.org/haskellwiki/Checkers>in addition to
QuickCheck, and I'd prefer not to make casual library users
have to pull in those libraries as well.

  - Conal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080909/62673e91/attachment.htm

More information about the Haskell-Cafe mailing list