Putting unit tests in cabal files (Was Re: [Haskell-cafe] HUnit)
Magnus Therning
magnus at therning.org
Fri May 22 10:23:30 EDT 2009
On Fri, May 22, 2009 at 1:08 PM, Henning Thielemann
<schlepptop at henning-thielemann.de> wrote:
> 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
> Else
> Buildable: False
Ah, didn't think of that, I've only ever tried
if flag(buildTests)
executable
but then cabal complains loudly about the if statement's location.
Now I can try to take this a bit further to see if I can get rid of
that ugly makefile altogether.
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus@therning.org Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe
More information about the Haskell-Cafe
mailing list