我在使用 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
在-file 中也test-framework-hunit
被列为依赖项:my_project.cabal
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
.