HUnit-Plus-0.3.0: A test framework building on HUnit.

Safe HaskellNone
LanguageHaskell2010

Test.HUnitPlus.Text

Contents

Description

Text-based reporting functionality for reporting either as text, or to the terminal. This module is an adaptation of code from the original HUnit library.

Note that the test execution function in this module are included for (a measure of) compatibility with HUnit, but are deprecated in favor of the function in the Test.HUnitPlus.Main module.

Synopsis

Utilities

data PutText st Source

The text-based reporters (textReporter and terminalReporter) construct strings and pass them to the function embodied in a PutText. This function handles the string in one of several ways. Two schemes are defined here. putTextToHandle writes report lines to a given handle. putTextToShowS accumulates lines for return as a whole.

The PutText function is also passed, and returns, an arbitrary state value (called st here). The initial state value is given in the PutText; the final value is returned by runTestText.

Constructors

PutText (String -> st -> IO st) st 

putTextToHandle :: Handle -> PutText () Source

Writes persistent lines to the given handle.

putTextToShowS :: PutText ShowS Source

Accumulates lines for return by runTestText. The accumulated lines are represented by a ShowS (String -> String) function whose first argument is the string to be appended to the accumulated report lines.

showCounts :: Counts -> String Source

Converts test execution counts to a string.

Text Reporting

textReporter Source

Arguments

:: PutText us

The method for outputting text.

-> Bool

Whether or not to output verbose text.

-> Reporter us 

Create a Reporter that outputs a textual report for non-terminal output.

runTestText Source

Arguments

:: PutText us

A function which accumulates output.

-> Bool

Whether or not to run the test in verbose mode.

-> Test

The test to run

-> IO (Counts, us) 

Execute a test, processing text output according to the given reporting scheme. The reporting scheme's state is threaded through calls to the reporting scheme's function and finally returned, along with final count values. The text is output in non-terminal mode.

This function is deprecated. The preferred way to run tests is to use the functions in Test.HUnitPlus.Main.

runSuiteText Source

Arguments

:: PutText us

A function which accumulates output.

-> Bool

Whether or not to run the tests in verbose mode.

-> TestSuite

The test suite to run.

-> IO (Counts, us) 

Execute a test suite, processing text output according to the given reporting scheme. The reporting scheme's state is threaded through calls to the reporting scheme's function and finally returned, along with final count values. The text is output in non-terminal mode.

This function is deprecated. The preferred way to run tests is to use the functions in Test.HUnitPlus.Main.

runSuitesText Source

Arguments

:: PutText us

A function which accumulates output

-> Bool

Whether or not to run the test in verbose mode.

-> [TestSuite]

The test to run

-> IO (Counts, us) 

Execute the given test suites, processing text output according to the given reporting scheme. The reporting scheme's state is threaded through calls to the reporting scheme's function and finally returned, along with final count values. The text is output in non-terminal mode.

This function is deprecated. The preferred way to run tests is to use the functions in Test.HUnitPlus.Main.

Terminal reporting

terminalReporter :: Reporter Int Source

A reporter that outputs lines indicating progress to the terminal. Reporting is made to standard error, and progress reports are included.

runTestTT :: Test -> IO Counts Source

Execute a test, processing text output according to the given reporting scheme. The reporting scheme's state is threaded through calls to the reporting scheme's function and finally returned, along with final count values. The text is output in terminal mode.

This function is deprecated. The preferred way to run tests is to use the functions in Test.HUnitPlus.Main.

runSuiteTT :: TestSuite -> IO Counts Source

Execute a test suite, processing text output according to the given reporting scheme. The reporting scheme's state is threaded through calls to the reporting scheme's function and finally returned, along with final count values. The text is output in terminal mode.

This function is deprecated. The preferred way to run tests is to use the functions in Test.HUnitPlus.Main.

runSuitesTT :: [TestSuite] -> IO Counts Source

Execute the given test suites, processing text output according to the given reporting scheme. The reporting scheme's state is threaded through calls to the reporting scheme's function and finally returned, along with final count values. The text is output in terminal mode.

This function is deprecated. The preferred way to run tests is to use the functions in Test.HUnitPlus.Main.