我在使用Test-Framework和HUnit设置单元测试时遇到了问题。
我的测试文件中有以下导入:
import Test.Framework
import Test.Framework.Providers.QuickCheck2
import Test.Framework.Providers.HUnit当我尝试在ghci中加载该文件时,我得到了错误消息:
test/MainTestSuite.hs:3:8:
Could not find module ‘Test.Framework.Providers.HUnit’
Perhaps you meant
Test.Framework.Providers.API (from test-framework-0.8.1.1)
Use -v to see a list of the files searched for.
Failed, modules loaded: none.只有加载Test.Framework和Test.Framework.Providers.QuickCheck2才能工作,并且可以运行测试。根据已安装的cabal test-framework-hunit:
$ cabal install test-framework-hunit
Resolving dependencies...
All the requested packages are already installed:
test-framework-hunit-0.3.0.1
Use --reinstall if you want to reinstall anyway.
Notice: installing into a sandbox located at
/home/XXX/projects/my_project/.cabal-sandbox此外,在my_project.cabal-file中,test-framework-hunit作为依赖项列出:
test-suite tests
main-is:
MainTestSuite.hs
type:
exitcode-stdio-1.0
hs-source-dirs:
test,
src
build-depends:
base,
HUnit,
QuickCheck,
test-framework,
test-framework-hunit,
test-framework-quickcheck2,
containers >=0.5 && <0.6
default-language:
Haskell2010我做错了什么?如果这很重要:我正在将所有内容安装到一个cabal-sandbox中。
发布于 2016-03-13 14:58:31
沙箱包对cabal可见,但对ghc或ghci不可见,不带其他标志。但是,您通常可以通过使用cabal exec myCmd执行某个进程来更改您的环境--尤其是对于ghci,cabal repl是一种功能更全的解决方案,它可以在各种情况下打开“您想要的东西”,无论是否有沙箱。
https://stackoverflow.com/questions/29328774
复制相似问题