[英]Problems with Test-Framework and HUnit
我在使用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
所有東西都安裝到cabal-sandbox
。
沙盒包對於cabal
是可見的,但是對ghc
或ghci
是可見的,沒有附加標志。 但是您可以通過使用cabal exec myCmd
執行環境來總體上更改進程的環境-甚至更好,特別是對於ghci
, cabal repl
是功能更全面的解決方案,可以在各種情況下打開“所需的東西” ,無論有無沙盒。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.