我正在尝试cabal test
运行我的 HUnit 测试,但运气不佳。问题是它找不到我的一个测试模块——我该如何解决这个问题?
cabal configure --enable-tests && cabal build && cabal test
失败了
tests/HUnit/Test.hs:4:18:
Could not find module `AmazonTest'
/测试/HUnit
AmazonTest.hs
module AmazonTest where
import Test.HUnit
import Lib.Amazon
tests = TestList [ "test sayHello" ~: "Hell!" ~=? sayHello ]
测试.hs
module Main where
import Test.HUnit
import qualified AmazonTest as Amazon
main = runTestTT Amazon.tests
\Lib\Amazon.hs
module Lib.Amazon where
sayHello :: String
sayHello = "Hello!"
测试我的 .cabal 文件的一部分
test-suite test
type: exitcode-stdio-1.0
main-is: tests/HUnit/Test.hs
hs-source-dirs: .
ghc-options: -Wall
build-depends: base
, myapp
, yesod-test >= 0.3 && < 0.4
, yesod-default
, yesod-core
, persistent
, persistent-postgresql
, resourcet
, monad-logger
, HUnit
, text