I tried to follow this guide in order to write some tests for a Haskell package using the detailed-0.9 test type. The cabal file is
Name: bar
Version: 1.0
License: BSD3
Cabal-Version: >= 1.10
Build-Type: Simple
Library
exposed-modules: Foo
build-depends: base >=4.9 && <4.10
default-language: Haskell2010
Test-Suite test-bar
type: detailed-0.9
test-module: Bar
build-depends: base, Cabal >= 1.9.2
default-language: Haskell2010
and Bar.hs is
module Bar ( tests ) where
import Distribution.TestSuite
tests :: IO [Test]
tests = return [ Test succeeds, Test fails ]
where
succeeds = TestInstance
{ run = return $ Finished Pass
, name = "succeeds"
, tags = []
, options = []
, setOption = \_ _ -> Right succeeds
}
fails = TestInstance
{ run = return $ Finished $ Fail "Always fails!"
, name = "fails"
, tags = []
, options = []
, setOption = \_ _ -> Right fails
}
However, when I run the tests with
cabal configure --enable-tests
cabal build
cabal test
I get
Preprocessing test suite 'test-bar' for bar-1.0...
[1 of 1] Compiling Main ( dist/build/test-barStub/test-barStub-tmp/test-barStub.hs, dist/build/test-barStub/test-barStub-tmp/Main.dyn_o )
Linking dist/build/test-barStub/test-barStub ...
Running 1 test suites...
Test suite test-bar: RUNNING...
Prelude.read: no parse
This also happens with the code from this repository.
Using strace cabal test I managed to see that the last file that cabal tries to open is dist/test/cabal-test-1804289383846930886.log, which does not exist. Creating the file does not help.
Is the detailed-0.9 test type still experimental? Should I use exitcode-stdio-1.0 instead?
GHC version: 8.0.1
cabal version: 1.24.0.0
Aucun commentaire:
Enregistrer un commentaire