Safe Haskell | None |
---|---|
Language | Haskell2010 |
HUnit support for tasty.
We don't use `tasty-hunit` directly because it doesn't interoperate properly
with other HUnit-based code.
Specifically, it defines its own HUnitFailure
type and catches exceptions
of this type. It doesn't catch HUnit's HUnitFailure
, so they are not
pretty-printed.
Synopsis
- testCase :: TestName -> Assertion -> TestTree
- testCaseInfo :: TestName -> IO String -> TestTree
- testCaseSteps :: TestName -> ((String -> IO ()) -> Assertion) -> TestTree
- assertFailure :: HasCallStack => String -> IO a
- assertBool :: HasCallStack => String -> Bool -> Assertion
- assertEqual :: (HasCallStack, Eq a, Show a) => String -> a -> a -> Assertion
- (@=?) :: (HasCallStack, Eq a, Show a) => a -> a -> Assertion
- (@?=) :: (HasCallStack, Eq a, Show a) => a -> a -> Assertion
- (@?) :: (HasCallStack, AssertionPredicable t) => t -> String -> Assertion
- class AssertionPredicable t where
- assertionPredicate :: t -> AssertionPredicate
- type Assertion = IO ()
- data HUnitFailure
- type HasCallStack = ?callStack :: CallStack
Documentation
Re-exports
:: HasCallStack | |
=> String | A message that is displayed with the assertion failure |
-> IO a |
Unconditionally signals that a failure has occurred.
:: HasCallStack | |
=> String | The message that is displayed if the assertion fails |
-> Bool | The condition |
-> Assertion |
Asserts that the specified condition holds.
:: (HasCallStack, Eq a, Show a) | |
=> String | The message prefix |
-> a | The expected value |
-> a | The actual value |
-> Assertion |
Asserts that the specified actual value is equal to the expected value. The output message will contain the prefix, the expected value, and the actual value.
If the prefix is the empty string (i.e., ""
), then the prefix is omitted
and only the expected and actual values are output.
:: (HasCallStack, Eq a, Show a) | |
=> a | The expected value |
-> a | The actual value |
-> Assertion |
Asserts that the specified actual value is equal to the expected value (with the expected value on the left-hand side).
:: (HasCallStack, Eq a, Show a) | |
=> a | The actual value |
-> a | The expected value |
-> Assertion |
Asserts that the specified actual value is equal to the expected value (with the actual value on the left-hand side).
:: (HasCallStack, AssertionPredicable t) | |
=> t | A value of which the asserted condition is predicated |
-> String | A message that is displayed if the assertion fails |
-> Assertion |
Asserts that the condition obtained from the specified
AssertionPredicable
holds.
class AssertionPredicable t where #
Used to signify that a data type can be converted to an assertion predicate.
assertionPredicate :: t -> AssertionPredicate #
Instances
AssertionPredicable Bool | |
Defined in Test.HUnit.Base | |
AssertionPredicable t => AssertionPredicable (IO t) | |
Defined in Test.HUnit.Base assertionPredicate :: IO t -> AssertionPredicate # |
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.
data HUnitFailure #
Instances
Eq HUnitFailure | |
Defined in Test.HUnit.Lang (==) :: HUnitFailure -> HUnitFailure -> Bool # (/=) :: HUnitFailure -> HUnitFailure -> Bool # | |
Show HUnitFailure | |
Defined in Test.HUnit.Lang showsPrec :: Int -> HUnitFailure -> ShowS # show :: HUnitFailure -> String # showList :: [HUnitFailure] -> ShowS # | |
Exception HUnitFailure | |
Defined in Test.HUnit.Lang |
type HasCallStack = ?callStack :: CallStack #
Request a CallStack.
NOTE: The implicit parameter ?callStack :: CallStack
is an
implementation detail and should not be considered part of the
CallStack
API, we may decide to change the implementation in the
future.
Since: base-4.9.0.0