doctest-0.24.2: Test interactive Haskell examples

Safe Haskell | None
Language | Haskell2010

Test.DocTest.Internal.Run

Synopsis

- type Result = Summary
- data Config = Config {
  - ghcOptions :: [String]
  - fastMode :: Bool
  - preserveIt :: Bool
  - failFast :: Bool
  - verbose :: Bool
  - repl :: (String, [String])
  }
- isSuccess :: Summary -> Bool
- doctest :: [String] -> IO ()
- defaultConfig :: Config
- doctestWithRepl :: (String, [String]) -> [String] -> IO ()
- doctestWith :: Config -> IO ()
- data Summary = Summary {
  - sExamples :: !Int
  - sTried :: !Int
  - sErrors :: !Int
  - sFailures :: !Int
  }
- formatSummary :: Summary -> String
- evaluateResult :: Result -> IO ()
- doctestWithResult :: Config -> IO Result
- runDocTests :: Config -> [Module [Located DocTest]] -> IO Result

# Documentation

type Result = Summary Source #

data Config Source #

Constructors

Config |

Fields

- ghcOptions :: [String]
- fastMode :: Bool
- preserveIt :: Bool
- failFast :: Bool
- verbose :: Bool
- repl :: (String, [String])

#### Instances

Instances details

Show Config Source # |
Instance details Defined in Options Methods showsPrec :: Int -> Config -> ShowS Source # show :: Config -> String Source # showList :: [Config] -> ShowS Source #
Eq Config Source # |
Instance details Defined in Options Methods (==) :: Config -> Config -> Bool Source # (/=) :: Config -> Config -> Bool Source #

isSuccess :: Summary -> Bool Source #

doctest :: [String] -> IO () Source #

Run doctest with given list of arguments.

Example:

    >>> doctest ["-iexample/src", "example/src/Example.hs"]
    ...
    Examples: 2  Tried: 2  Errors: 0  Failures: 0

This can be used to create a Cabal test suite that runs doctest for your project.

If a directory is given, it is traversed to find all .hs and .lhs files inside of it, ignoring hidden entries.

defaultConfig :: Config Source #

doctestWithRepl :: (String, [String]) -> [String] -> IO () Source #

doctestWith :: Config -> IO () Source #

data Summary Source #

Summary of a test run.

Constructors

Summary |

Fields

- sExamples :: !Int
- sTried :: !Int
- sErrors :: !Int
- sFailures :: !Int

#### Instances

Instances details

Monoid Summary Source # | Sum up summaries.
Instance details Defined in Runner Methods mempty :: Summary Source # mappend :: Summary -> Summary -> Summary Source # mconcat :: [Summary] -> Summary Source #
Semigroup Summary Source # |
Instance details Defined in Runner Methods (<>) :: Summary -> Summary -> Summary Source # sconcat :: NonEmpty Summary -> Summary Source # stimes :: Integral b => b -> Summary -> Summary Source #
Show Summary Source # |
Instance details Defined in Runner Methods showsPrec :: Int -> Summary -> ShowS Source # show :: Summary -> String Source # showList :: [Summary] -> ShowS Source #
Eq Summary Source # |
Instance details Defined in Runner Methods (==) :: Summary -> Summary -> Bool Source # (/=) :: Summary -> Summary -> Bool Source #

formatSummary :: Summary -> String Source #

evaluateResult :: Result -> IO () Source #

doctestWithResult :: Config -> IO Result Source #

runDocTests :: Config -> [Module [Located DocTest]] -> IO Result Source #