Putting unit tests in cabal files (Was Re: [Haskell-cafe] HUnit)

Henning Thielemann schlepptop at henning-thielemann.de
Fri May 22 08:08:22 EDT 2009

Magnus Therning schrieb:
> On Fri, May 22, 2009 at 12:13 AM, Vasili I. Galchin <vigalchin at gmail.com> wrote:
>> Hello,
>>     I have some code with several test cases that use HUnit. I added hunit
>> as one of my cabal dependencies but cabal complained with:
>> Setup: At least the following dependencies are missing:
>> hutil -any
>> What am I doing incorrectly?
> Would you mind posting your .cabal file too?
> The reson I'm asking is that I've so far _never_ put any information
> about unit tests or quickcheck tests in my .cabal file, simply because
> I don't want the executables to be picked up by automatic package
> converters such as cabal2arch.  Instead I have a makefile for building
> my test programs.
> If you have some way of keeping information about building of tests in
> your .cabal I'd be very interested in seeing it.

I define and use Cabal flag buildTests and use

Executable test
  If flag(buildTests)
    Build-Depends: HUnit
    Buildable: False

More information about the Haskell-Cafe mailing list