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 # |
Instance details Defined in Test.HUnit.Lang Methods (==) :: Location -> Location -> Bool # (/=) :: Location -> Location -> Bool #
Ord Location # |
Instance details Defined in Test.HUnit.Lang Methods compare :: Location -> Location -> Ordering # (<) :: Location -> Location -> Bool # (<=) :: Location -> Location -> Bool # (>) :: Location -> Location -> Bool # (>=) :: Location -> Location -> Bool # max :: Location -> Location -> Location # min :: Location -> Location -> Location #
Show Location # |
Instance details Defined in Test.HUnit.Lang Methods showsPrec :: Int -> Location -> ShowS # show :: Location -> String # showList :: [Location] -> ShowS #

data Result #

Constructors

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

Instances

Eq Result # |
Instance details Defined in Test.HUnit.Lang Methods (==) :: Result -> Result -> Bool # (/=) :: Result -> Result -> Bool #
Ord Result # |
Instance details Defined in Test.HUnit.Lang Methods compare :: Result -> Result -> Ordering # (<) :: Result -> Result -> Bool # (<=) :: Result -> Result -> Bool # (>) :: Result -> Result -> Bool # (>=) :: Result -> Result -> Bool # max :: Result -> Result -> Result # min :: Result -> Result -> Result #
Show Result # |
Instance details Defined in Test.HUnit.Lang Methods showsPrec :: Int -> Result -> ShowS # show :: Result -> String # showList :: [Result] -> ShowS #

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 # |
Instance details Defined in Test.HUnit.Lang Methods (==) :: HUnitFailure -> HUnitFailure -> Bool # (/=) :: HUnitFailure -> HUnitFailure -> Bool #
Ord HUnitFailure # |
Instance details Defined in Test.HUnit.Lang Methods compare :: HUnitFailure -> HUnitFailure -> Ordering # (<) :: HUnitFailure -> HUnitFailure -> Bool # (<=) :: HUnitFailure -> HUnitFailure -> Bool # (>) :: HUnitFailure -> HUnitFailure -> Bool # (>=) :: HUnitFailure -> HUnitFailure -> Bool # max :: HUnitFailure -> HUnitFailure -> HUnitFailure # min :: HUnitFailure -> HUnitFailure -> HUnitFailure #
Show HUnitFailure # |
Instance details Defined in Test.HUnit.Lang Methods showsPrec :: Int -> HUnitFailure -> ShowS # show :: HUnitFailure -> String # showList :: [HUnitFailure] -> ShowS #
Exception HUnitFailure # |
Instance details Defined in Test.HUnit.Lang Methods toException :: HUnitFailure -> SomeException # fromException :: SomeException -> Maybe HUnitFailure # displayException :: HUnitFailure -> String #