简体   繁体   中英

Cabal not performing quickCheck test

I'm writing a cabal file to install a library written with Haskell. I want some tests (written with quickCheck ) to be performed at installation.

The cabal file looks like :

...
build-type:          Simple
cabal-version:       >=1.8


Test-Suite my_tests
  Type:               exitcode-stdio-1.0
  Hs-Source-Dirs:     test
  Main-is:            Tests.hs

Library
  Hs-Source-Dirs:     src
  Exposed-modules:      HsMesher.Fonctions
                      , HsMesher.Types
                      , HsMesher.Algorithmes1D.Arcs
                      , HsMesher.Algorithmes1D.Segments

  Build-depends:       base ==4.5.*

and the Test.hs file to perform tests is :

import Test.QuickCheck
import HsMesher.Algorithmes1D.Segments
import HsMesher.Algorithmes1D.Arcs
import HsMesher.Types

...

main = do
  putStrLn "My tests"
  quickCheck prop_test1
  quickCheck prop_test2

when I run runhaskell test/Tests.hs test routine is performed correctly.

But when I type cabal configure --enable-tests && cabal build && cabal test , tests are not performed and I have the following message :

cabal: No test suites enabled. Did you remember to configure with '--enable-tests'?

However library is installed correctly with cabal install and archived correctly with cabal sdist .

Do you have an idea of what is wrong ?
Is there something I didn't understand in the integration of quickCheck with Cabal ?

I'm using cabal v1.14.0, ghc v7.4.1

It 's important to not forget dependency when calling test suite as far as cabal doesn't complain explicitly when you forget them.

Test-Suite my_tests
  Type:               exitcode-stdio-1.0
  Hs-Source-Dirs:     test
  Main-is:            Tests.hs
  Build-depends:      base ==4.5.* , HsMesher, QuickCheck 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM