that test hook

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Jun 1 19:06:30 EDT 2009


On Mon, 2009-05-18 at 10:23 +1000, Peter Gammie wrote:
> Hello,
> 
> I see from the archives that this hook is much unloved.

Yes :-)

> How is one supposed to use it?

 :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()

You get IO (), you can do whatever you like!

There are no particular conventions.

> The arguments to the function are underspecified. What is the Bool?

It's not used. It means nothing. If it help, the value is always
False :-)

If you do the archaeology and work it out I'd be interested to know. In
Cabal-0.5 runTests is never called. In Cabal-1.1.1 it is always called
with False.

In version 0.4 it has the type:
  runTests :: Bool -> IO ExitCode  -- ^Used for @.\/setup test@

but it is never called and there's no other comment hinting at what it
might be for. In version 0.2 it doesn't exist yet. So I've run out of
clues.

> I want access to the command-line flags, or at least verbosity  
> settings. How do I do that?

The command line flags are not passed, only the additional non-flag
arguments.

> I envisage testing like so (approx):
> 
> Setup test file
> Setup test dir
> Setup test --verbose

You can do the first two.

> Has anyone used it in anger?

I believe a couple projects use it, including darcs.

I hope to replace it one day with something sane and useful.

Duncan



More information about the cabal-devel mailing list