HTF-0.12.2.1: The Haskell Test Framework

Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Framework.AssertM

Description

This module defines the AssertM monad, which allows you either to run assertions as ordinary unit tests or to evaluate them as pure functions.

Synopsis

Documentation

class Monad m => AssertM m where Source

A typeclass for generic assertions.

data AssertStackElem Source

Stack trace element for generic assertions.

data AssertBool a Source

Type for evaluating a generic assertion as a pure function.

Constructors

AssertOk a

Assertion passes successfully and yields the given value.

AssertFailed [AssertStackElem]

Assertion fails with the given stack trace. In the stack trace, the outermost stackframe comes first.

boolValue :: AssertBool a -> Bool Source

Evaluates a generic assertion to a Bool value.

eitherValue :: AssertBool a -> Either String a Source

Evaluates a generic assertion to an Either value. The result is Right x if the assertion passes and yields value x, otherwise the result is Left err, where err is an error message.

formatStack :: [AssertStackElem] -> String Source

Formats a stack trace.