繁体   English   中英

测试框架和HUnit的问题

[英]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.FrameworkTest.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是可见的,但是对ghcghci是可见的,没有附加标志。 但是您可以通过使用cabal exec myCmd执行环境来总体上更改进程的环境-甚至更好,特别是对于ghcicabal repl是功能更全面的解决方案,可以在各种情况下打开“所需的东西” ,无论有无沙盒。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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