Test.HUnit.Lang

HUnit-1.3.1.1: A unit testing framework for Haskell

Safe Haskell | Safe
Language | Haskell98

Test.HUnit.Lang

Contents

- Internals

Synopsis

- type Assertion = IO ()
- assertFailure :: (?loc :: CallStack) => String -> Assertion
- data Location = Location {
  - locationFile :: FilePath
  - locationLine :: Int
  - locationColumn :: Int
  }
- data Result
  - = Success
  - | Failure (Maybe Location) String
  - | Error (Maybe Location) String
- performTestCase :: Assertion -> IO Result
- data HUnitFailure = HUnitFailure (Maybe Location) String

# Documentation

type Assertion = IO ()

When an assertion is evaluated, it will output a message if and only if the assertion fails.

Test cases are composed of a sequence of one or more assertions.

assertFailure

Arguments

:: (?loc :: CallStack) |
=> String | A message that is displayed with the assertion failure
-> Assertion |

Unconditionally signals that a failure has occured. All other assertions can be expressed with the form:

       if conditionIsMet
           then IO ()
           else assertFailure msg

data Location

Constructors

Location |
Fields locationFile :: FilePath locationLine :: Int locationColumn :: Int

Instances

Eq Location |
Ord Location |
Show Location |

data Result

Constructors

Success |
Failure (Maybe Location) String |
Error (Maybe Location) String |

Instances

Eq Result |
Ord Result |
Show Result |

performTestCase

Arguments

:: Assertion | an assertion to be made during the test case run
-> IO Result |

Performs a single test case.

# Internals

Note: This is not part of the public API! It is exposed so that you can tinker with the internals of HUnit, but do not expect it to be stable!

data HUnitFailure

Constructors

HUnitFailure (Maybe Location) String |

Instances

Eq HUnitFailure |
Ord HUnitFailure |
Show HUnitFailure |
Exception HUnitFailure |