我有一个 Haskell 项目和 Cabal 包描述,允许我构建和安装我的包
$ cabal configure $ cabal build $ cabal install
但是 cabal test
呢? Cabal 的帮助说要使用 UserHooks 配置测试套件,但我该怎么做?
最佳答案
正如 Duncan 在 Greg 的回答中提到的,Cabal-1.10 支持开箱即用的测试套件。
manual似乎拥有我所找到的关于如何使用它的最佳信息。
这是手册中的一个片段,展示了如何使用 exitcode-stdio
测试类型:
foo.cabal
Name: foo
Version: 1.0
License: BSD3
Cabal-Version: >= 1.9.2
Build-Type: Simple
Test-Suite test-foo
type: exitcode-stdio-1.0
main-is: test-foo.hs
build-depends: base
test-foo.hs:
module Main where
import System.Exit (exitFailure)
main = do
putStrLn "This test always fails!"
exitFailure
关于testing - 我如何使用 Cabal 设置一个简单的测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1044555/