Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- data PutText st = PutText (String -> st -> IO st) st
- putTextToHandle :: Handle -> PutText ()
- putTextToShowS :: PutText ShowS
- showCounts :: Counts -> String
- textReporter :: PutText us -> Bool -> Reporter us
- runTestText :: PutText us -> Bool -> Test -> IO (Counts, us)
- runSuiteText :: PutText us -> Bool -> TestSuite -> IO (Counts, us)
- runSuitesText :: PutText us -> Bool -> [TestSuite] -> IO (Counts, us)
- terminalReporter :: Reporter Int
- runTestTT :: Test -> IO Counts
- runSuiteTT :: TestSuite -> IO Counts
- runSuitesTT :: [TestSuite] -> IO Counts
Utilities
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
.
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
function whose first argument is the string to be
appended to the accumulated report lines.ShowS
(String
->
String
)
showCounts :: Counts -> String Source
Converts test execution counts to a string.
Text Reporting
:: 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.
:: 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.
:: 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.
:: 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.