| Safe Haskell | Safe-Infered |
|---|
Test.DocTest
Description
An experimental API for extracting and executing DocTests.
Use getDocTests to extract DocTest examples from Haddock comments. To
verify that the examples work turn them into Assertions, 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
Arguments
| :: [String] | List of GHC flags |
| -> [String] | File or module names |
| -> IO [DocTest] | Extracted |
Extract DocTests 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
Arguments
| :: [String] | List of flags, passed to GHC |
| -> (Interpreter -> IO a) | Action to run |
| -> IO a | Result of action |