| Safe Haskell | Safe-Inferred |
|---|
Test.Framework.TestInterface
Description
This module defines the API for HTF plugins.
- type Assertion = IO ()
- data TestResult
- data FullTestResult = FullTestResult {
- ftr_location :: Maybe Location
- ftr_callingLocations :: [(Maybe String, Location)]
- ftr_message :: Maybe ColorString
- ftr_result :: Maybe TestResult
- data HTFFailureException = HTFFailure FullTestResult
- failHTF :: MonadBaseControl IO m => FullTestResult -> m a
- subAssertHTF :: MonadBaseControl IO m => Location -> Maybe String -> m a -> m a
- mkFullTestResult :: TestResult -> Maybe String -> FullTestResult
Documentation
An assertion is just an IO action. Internally, the body of any test
in HTF is of type Assertion. If a test specification of a certain plugin
has a type different from Assertion, the plugin's preprocessor pass must
inject wrapper code to convert the test specification into an assertion.
Assertions may use failHTF to signal a TestResult different from
Pass. If the assertion finishes successfully, the tests passes
implicitly.
Please note: the assertion must not swallow any exceptions! Otherwise, timeouts and other things might not work as expected.
data TestResult Source
The summary result of a test.
Instances
| Eq TestResult | |
| Read TestResult | |
| Show TestResult | |
| ToJSON TestResult | |
| FromJSON TestResult |
data FullTestResult Source
The full result of a test, as used by HTF plugins.
Constructors
| FullTestResult | |
Fields
| |
Instances
| Eq FullTestResult | |
| Read FullTestResult | |
| Show FullTestResult |
data HTFFailureException Source
Constructors
| HTFFailure FullTestResult |
Instances
| Show HTFFailureException | |
| Typeable HTFFailureException | |
| Exception HTFFailureException |
failHTF :: MonadBaseControl IO m => FullTestResult -> m aSource
Terminate a HTF test, usually to signal a failure. The result of the test
is given in the FullTestResult argument.
subAssertHTF :: MonadBaseControl IO m => Location -> Maybe String -> m a -> m aSource
Opens a new assertion stack frame to allow for sensible location information.
mkFullTestResult :: TestResult -> Maybe String -> FullTestResultSource
Auxiliary function for contructing a FullTestResult.