I am trying to follow the examples from here http://www.haskell.org/cabal/users-guide/#test-suites
When I run cabal test it throws this error cabal: No test suites enabled. Did you remember to configure with '--enable-tests'?
cabal: No test suites enabled. Did you remember to configure with '--enable-tests'?
so I try cabal configure --enable-tests
and then cabal test
but I now get
Running 1 test suites...
Test suite test-s3dm: RUNNING...
cabal: permission denied
What am I doing wrong?
You still need to actually build the tests and the program which you want to test. so you need to do cabal build
after configure.
But I would agree that that error message should be something else.
I had the same problem that you did. The cause of it was that the test suite file wasn't getting compiled into an executable. Turned out that no matter how I configured it, Cabal didn't produce executables for modules located in some namespaces (eg Pkg.Main
) and complained about not being able to find a Main
module during building phase.
The solution I found was to move both the Main
module and the TestSuite
module into the core src/
folder and to remove the heading module
declarations in those files.
Here's how my working cabal
config looks now:
name: Pwn
version: 0.1
cabal-version: >= 1.2
build-type: Simple
executable main
hs-source-dirs: src
main-is: main.hs
build-depends: base >= 4 && < 5,
random,
containers
test-suite test-suite
hs-source-dirs: src
main-is: test-suite.hs
build-depends:
base >= 4 && < 5,
test-framework >= 0.4.1,
test-framework-quickcheck,
test-framework-hunit
type: exitcode-stdio-1.0
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.