Unit testing 获得;前奏曲:无解析“;对阴谋集团使用详细-0.9测试时出错

Unit testing 获得;前奏曲:无解析“;对阴谋集团使用详细-0.9测试时出错,unit-testing,haskell,cabal,Unit Testing,Haskell,Cabal,为了使用detailed-0.9测试类型为Haskell软件包编写一些测试,我尝试遵循这一点。阴谋集团的档案是 Name: bar Version: 1.0 License: BSD3 Cabal-Version: >= 1.10 Build-Type: Simple Library exposed-modules: Foo build-depends: base >=4.9 &&

为了使用
detailed-0.9
测试类型为Haskell软件包编写一些测试,我尝试遵循这一点。阴谋集团的档案是

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
但是,当我使用

cabal configure --enable-tests
cabal build
cabal test
我明白了

来自的代码也会发生这种情况

使用
strace-cabal-test
我设法看到cabal试图打开的最后一个文件是
dist/test/cabal-test-18042893846930886.log
,它不存在。创建文件没有帮助

detailed-0.9
测试类型仍处于试验阶段吗?我应该改用exitcode-stdio-1.0吗

GHC版本:8.0.1
阴谋集团版本:1.24.0.0

编辑:
即使我在
Bar.hs
中设置
tests=return[]
,错误仍然存在。问题似乎在于动态链接。阴谋集团找不到测试的结果。在我的例子中,添加到
dist/build/bar-1.0-1l0Xa8pRO0dDWU0quwEdrS-test-bar.test/libHSbar-1.0-1l0Xa8pRO0dDWU0quwEdrS-test-bar.test-ghc8.0.1的链接解决了问题,但文件名可能会更改

另一种方法是在配置包时使用
cabalconfigure--enable tests--disable shared
(我在cabal config中隐式使用
--enable shared
)。或者我可以破解一个脚本,在调用
cabaltest
之前将
LD\u LIBRARY\u PATH
设置为正确的值


编辑:已经有一个。

你的代码(加上一个stub Foo.hs)适合我。我见过测试程序崩溃时会发生这种错误。我也无法重现这种错误。这对我来说很好,使用相同的ghc和cabal。建房前你有没有试过
cabalclean
?@Michael是的,我试过运行
cabalclean
,但没什么不同。是否存在任何可能会干扰此操作的配置?或者任何包裹?
cabal configure --enable-tests
cabal build
cabal test
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