
Hello, I see from the archives that this hook is much unloved. How is one supposed to use it? The arguments to the function are underspecified. What is the Bool? I want access to the command-line flags, or at least verbosity settings. How do I do that? I envisage testing like so (approx): Setup test file Setup test dir Setup test --verbose Has anyone used it in anger? cheers peter

I note there is already a "-v" flag for the "test" hook. How do I get my hands on that in the test hook itself? On 18/05/2009, at 10:23 AM, Peter Gammie wrote:
Hello,
I see from the archives that this hook is much unloved.
How is one supposed to use it?
The arguments to the function are underspecified. What is the Bool?
I want access to the command-line flags, or at least verbosity settings. How do I do that?
I envisage testing like so (approx):
Setup test file Setup test dir Setup test --verbose
Has anyone used it in anger?
cheers peter

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

On Tue, Jun 02, 2009 at 12:06:30AM +0100, Duncan Coutts wrote:
On Mon, 2009-05-18 at 10:23 +1000, Peter Gammie wrote:
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 think it was intended to be for whether the tests were being run for the installed library, or for the library in the build tree. Thanks Ian
participants (3)
-
Duncan Coutts
-
Ian Lynagh
-
Peter Gammie