[英]Cabal tests on windows 7
I am trying to follow the examples from here http://www.haskell.org/cabal/users-guide/#test-suites 我试图按照这里的例子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测试时,它会抛出此错误信号
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 所以我尝试
cabal configure --enable-tests
然后cabal test
但我现在得到了
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. 所以你需要在配置后进行
cabal build
。
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. 事实证明,无论我如何配置它,Cabal都没有为位于某些名称空间(例如
Pkg.Main
)的模块生成可执行文件,并抱怨在构建阶段无法找到Main
模块。
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. 我找到的解决方案是将
Main
模块和TestSuite
模块移动到核心src/
文件夹中,并删除这些文件中的标题module
声明。
Here's how my working cabal
config looks now: 以下是我的工作
cabal
配置现在的样子:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.