I'm trying to get started with hspec. I've got a working case working with QuickCheck, but I would just like some more detail when running cabal test
. I found this article from hspec, giving instructions on supplying some more detailed control when running the executable. I'm currently using hi
to initialize my haskell packages, so my cabal test suite looks like this:
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
My guess is something like "default command line arguments", but that just doesn't feel right. How could I supply arguments to a hspec suite?
Also, this might be important. hi
splits the test suite so that the only content in Spec.hs
is:
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
but all tests and code reside in test/MainSpec.hs
, which exports main
and spec
.
Check out the Using a custom main function section on http://hspec.github.io/hspec-discover.html
Relevant bits copied here for your convenience: