Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell 从阴谋集团向HSpec提供选项_Haskell_Quickcheck_Hspec - Fatal编程技术网

Haskell 从阴谋集团向HSpec提供选项

Haskell 从阴谋集团向HSpec提供选项,haskell,quickcheck,hspec,Haskell,Quickcheck,Hspec,我正在尝试开始hspec。我有一个使用QuickCheck的工作案例,但我只想在运行cabal test时了解更多细节。我从hspec中找到了一些关于在运行可执行文件时提供更详细控制的说明。我目前正在使用hi初始化haskell包,因此我的cabal测试套件如下所示: Test-Suite spec Type: exitcode-stdio-1.0 Default-Language: Haskell2010 Hs-Source-Dirs:

我正在尝试开始hspec。我有一个使用QuickCheck的工作案例,但我只想在运行
cabal test
时了解更多细节。我从hspec中找到了一些关于在运行可执行文件时提供更详细控制的说明。我目前正在使用
hi
初始化haskell包,因此我的cabal测试套件如下所示:

Test-Suite spec
  Type:                 exitcode-stdio-1.0
  Default-Language:     Haskell2010
  Hs-Source-Dirs:       src
                      , test
  Ghc-Options:          -Wall
  Main-Is:              Spec.hs
  Build-Depends:        base
                      , hspec
                      , QuickCheck
                      , quickcheck-instances
                      , mtl
                      , text
                      , transformers
我的猜测有点像“默认命令行参数”,但这感觉不对。如何向hspec套件提供参数

而且,这可能很重要
hi
拆分测试套件,以便
Spec.hs
中的唯一内容是:

{-# OPTIONS_GHC -F -pgmF hspec-discover #-}

但是所有测试和代码都驻留在
test/MainSpec.hs
中,它导出
main
spec

使用上的自定义主功能查看

为方便起见,请将相关信息复制到此处:

下面是一个示例,说明如何利用它来指定 不同的默认格式化程序:

-- file test/Spec.hs
{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-}

-- file test/Main.hs
module Main where

import Test.Hspec.Runner
import Test.Hspec.Formatters
import qualified Spec

main :: IO ()
main = hspecWith defaultConfig {configFormatter = Just progress} Spec.spec