Safe Haskell | Safe-Infered |
---|
An experimental API for extracting and executing DocTest
s.
Use getDocTests
to extract DocTest
examples from Haddock comments. To
verify that the examples work turn them into Assertion
s, using
withInterpreter
and toAssertion
. After this just wrap the newly minted
assertions into something suitable for your favorite test framework.
- data DocTest
- getDocTests :: [String] -> [String] -> IO [DocTest]
- sourcePath :: DocTest -> FilePath
- firstExpression :: DocTest -> String
- toAssertion :: Interpreter -> DocTest -> Assertion
- data Interpreter
- withInterpreter :: [String] -> (Interpreter -> IO a) -> IO a
Documentation
Extract DocTest
s from all given modules and all modules included by the
given modules.
sourcePath :: DocTest -> FilePathSource
Instead of what the name suggests, this returns the module name, not the file name.
toAssertion :: Interpreter -> DocTest -> AssertionSource
Execute all expressions from given DocTest
in given
Interpreter
and verify the output.
The interpreter state is zeroed with :reload
before executing the
expressions. This means that you can reuse the same
Interpreter
for several calls to toAssertion
.
data Interpreter Source
:: [String] | List of flags, passed to GHC |
-> (Interpreter -> IO a) | Action to run |
-> IO a | Result of action |