繁体   English   中英

Windows 7上的Cabal测试

[英]Cabal tests on windows 7

我试图按照这里的例子http://www.haskell.org/cabal/users-guide/#test-suites

当我运行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'?

所以我尝试cabal configure --enable-tests然后cabal test但我现在得到了

Running 1 test suites...
Test suite test-s3dm: RUNNING...
cabal: permission denied

我究竟做错了什么?

您仍然需要实际构建测试和要测试的程序。 所以你需要在配置后进行cabal build

但我同意该错误信息应该是别的。

我遇到了同样的问题。 原因是测试套件文件没有被编译成可执行文件。 事实证明,无论我如何配置它,Cabal都没有为位于某些名称空间(例如Pkg.Main )的模块生成可执行文件,并抱怨在构建阶段无法找到Main模块。

我找到的解决方案是将Main模块和TestSuite模块移动到核心src/文件夹中,并删除这些文件中的标题module声明。

以下是我的工作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.

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