当您在 yesod 中创建脚手架站点时,它会将测试放入单独的目录中,如下所示:
YourProj/
YourProj/SomeModule.hs
YourProj/Handlers/FooHandler.hs
...
YourProj/tests/main.hs
YourProj/tests/FooTests.hs
所以,现在我想启动 ghci 并从中导入一些代码YourProj/tests/main.hs
或YourProj/tests/FooTests.hs
使用它。我该怎么做?我试过了:
cabal-dev ghci
> :set -itests
> :load tests/TestImport.hs
tests/TestImport.hs:15:8:
Could not find module `Control.Monad.IO.Class'
It is a member of the hidden package `transformers-0.3.0.0'.
Perhaps you need to add `transformers' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
build-depends
因此,虽然我成功添加了子目录,但由于测试套件的 cabal 文件中参数的 cabal 配置不同,我仍然遇到问题。
我将如何启动 cabal-dev ghci 并从 Yesod 的测试中导入一些代码?