doctest-parallel
currently assumes you have a .cabal
file in your project. If this is the case, it can be setup by adding the following:
test-suite doctests
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: doctests.hs
ghc-options: -threaded
build-depends: base, your-project, doctest-parallel >= 0.1
default-language: Haskell2010
You can omit this file if your project is a Stack-only project. Otherwise, add the following:
write-ghc-environment-files: always
If this file does not yet exist, also add:
packages:
.
module Main where
import Test.DocTest (mainFromCabal)
import System.Environment (getArgs)
main :: IO ()
main = mainFromCabal "your-project" =<< getArgs
Execute:
cabal run doctests
At the moment, using cabal test
is not reliable. See #22.
Stack users can use:
stack test example:doctestsstack test
It will also run as part of stack test
.
Run:
cabal run doctests -- --help
Or:
stack test example:doctests --test-arguments --help
Example output:
Usage:
doctest [ options ]... [<module>]...
doctest --help
doctest --version
doctest --info
Options:
-jN number of threads to use
† --implicit-module-import import module before testing it (default)
† --randomize-order randomize order in which tests are run
† --seed=N use a specific seed to randomize test order
† --preserve-it preserve the `it` variable between examples
--verbose print each test as it is run
--quiet only print errors
--help display this help and exit
--version output version information and exit
--info output machine-readable version information and exit
Supported inverted options:
† --no-implicit-module-import
† --no-randomize-order (default)
† --no-preserve-it (default)
Options marked with a dagger (†) can also be used to set module level options, using
an ANN pragma like this:
{-# ANN module "doctest-parallel: --no-randomize-order" #-}