David Fox wrote:
> Isn't this better done from the Setup.hs file?
> 
> main = defaultMainWithHooks simpleUserHooks {
>          runTests = runTestScript
>        , postBuild = runTestScript
>        }
> 
> runTestScript _args _flag _pd _lbi =
>     system "runhaskell Test/Main.hs" >>=
>     \ code -> if code == ExitSuccess then return () else error "Test Failure"
> 

Not really.  That has several flaws.  One is that I don't always want to
build and run the tests, because the tests add multiple dependencies.
Another is that your approach isn't using Cabal to build the tests,
which is a significant complicating factor in many cases.

In most of my packages, I have something like this in .cabal:

flag buildtests
  description: Build the executable to run unit tests
  default: False

...

Executable runtests
   if flag(buildtests)
      Buildable: True
      Build-Depends: HUnit, QuickCheck, testpack
   else
      Buildable: False
   Main-Is: runtests.hs
   Other-Modules: TestSqlValue
...


-- 
To UNSUBSCRIBE, email to debian-haskell-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4b7c576b.2040...@complete.org

Reply via email to