vt-utils-1.3.0.0: Vector and Text utilities

Safe HaskellNone
LanguageHaskell2010

VtUtils.HUnit

Description

HUnit utilities

Synopsis

Documentation

hunitCatchException :: Exception e => Text -> IO a -> IO e Source #

Runs the specified action and catches and returs exception of the specified type

Throws an exception, if exception of specified type is not thrown by the specified action

Arguments:

  • msg :: Text: Error message to include with exception that is thrown on error
  • action :: IO a IO action that should throw the exception

Return value: exception record thrown by the specified action

hunitMain :: Vector Test -> IO () Source #

Runs all, group or one of specified HUnit tests depending on the command line arguments

Example specifying argument to stack test invocation:

stack test --ta "GroupName testName"

If no arguments are specified - all test are run.grlabel

If single argument is specified - it is interpreted as a name of the group.grlabel

If two argument are specified - first one is interpreted as a group name, and second one as a test name

Throws an exception on invalid command line argument

Tests results are printed to stdout

Arguments:

  • tests :: Vector Test: HUnit tests to run

hunitRun :: Vector Test -> IO () Source #

Runs all HUnit tests from a specified Vector

Tests results are printed to stdout

Arguments:

  • tests :: Vector Test: HUnit tests to run

hunitRunGroup :: Vector Test -> Text -> IO () Source #

Runs a subset of HUnit tests with a specified label value

Throws an exception if no tests in the specified Vector have specified label or if some tests in the specified Vector have no label at all

Tests results are printed to stdout

Arguments:

  • tests :: Vector Test: HUnit tests
  • label :: Text: Group label

hunitRunSingle :: Vector Test -> Text -> Text -> IO () Source #

Runs a single test from a specified Vector of HUnit tests

Throws an exception if a test with a specified group label and test label is not found in specified Vector of tests

Tests results are printed to stdout

Arguments:

  • tests :: Vector Test: HUnit tests
  • grlabel :: Text: Group label
  • tslabel :: Text: Test label