HTF-0.15.0.2: The Haskell Test Framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Framework.TestInterface

Description

This module defines the API for HTF tests, i.e. unit tests and quickcheck properties.

This functionality is mainly used internally in the code generated by the hftpp pre-processor.

Synopsis

Documentation

type Assertion = IO () Source #

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 FullTestResult Source #

The full result of a test, as used by HTF plugins.

Constructors

FullTestResult 

Fields

formatHtfStack :: HtfStack -> String Source #

Formats a stack trace.

failHTF :: MonadBaseControl IO m => FullTestResult -> m a Source #

Terminate a HTF test, usually to signal a failure. The result of the test is given in the FullTestResult argument.

subAssertHTF :: (HasCallStack, MonadBaseControl IO m) => Maybe String -> m a -> m a Source #

Opens a new assertion stack frame to allow for sensible location information. This function should be used if the function being called does not carry a HasCallStack annotation.

mkFullTestResult :: TestResult -> Maybe String -> FullTestResult Source #

Auxiliary function for contructing a FullTestResult.