<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Test.HUnit.Text</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Test-HUnit-Text.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Test-HUnit-Text.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">HUnit-1.2.2.3: A unit testing framework for Haskell</p></div><div id="content"><div id="module-header"><p class="caption">Test.HUnit.Text</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Text-based test controller for running HUnit tests and reporting results as text, usually to a terminal. </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:PutText">PutText</a> st = <a href="#v:PutText">PutText</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -> st -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> st) st</li><li class="src short"><a href="#v:putTextToHandle">putTextToHandle</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="Test-HUnit-Text.html#t:PutText">PutText</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:putTextToShowS">putTextToShowS</a> :: <a href="Test-HUnit-Text.html#t:PutText">PutText</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:runTestText">runTestText</a> :: <a href="Test-HUnit-Text.html#t:PutText">PutText</a> st -> <a href="Test-HUnit-Base.html#t:Test">Test</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="Test-HUnit-Base.html#t:Counts">Counts</a>, st)</li><li class="src short"><a href="#v:showPath">showPath</a> :: <a href="Test-HUnit-Base.html#t:Path">Path</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li class="src short"><a href="#v:showCounts">showCounts</a> :: <a href="Test-HUnit-Base.html#t:Counts">Counts</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li class="src short"><a href="#v:runTestTT">runTestTT</a> :: <a href="Test-HUnit-Base.html#t:Test">Test</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Test-HUnit-Base.html#t:Counts">Counts</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:PutText" class="def">PutText</a> st <a href="src/Test-HUnit-Text.html#PutText" class="link">Source</a></p><div class="doc"><p>As the general text-based test controller (<code><a href="Test-HUnit-Text.html#v:runTestText">runTestText</a></code>) executes a test, it reports each test case start, error, and failure by constructing a string and passing it to the function embodied in a <code><a href="Test-HUnit-Text.html#t:PutText">PutText</a></code>. A report string is known as a "line", although it includes no line terminator; the function in a <code><a href="Test-HUnit-Text.html#t:PutText">PutText</a></code> is responsible for terminating lines appropriately. Besides the line, the function receives a flag indicating the intended "persistence" of the line: <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#v:True">True</a></code> indicates that the line should be part of the final overall report; <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#v:False">False</a></code> indicates that the line merely indicates progress of the test execution. Each progress line shows the current values of the cumulative test execution counts; a final, persistent line shows the final count values. </p><p>The <code><a href="Test-HUnit-Text.html#t:PutText">PutText</a></code> function is also passed, and returns, an arbitrary state value (called <code>st</code> here). The initial state value is given in the <code><a href="Test-HUnit-Text.html#t:PutText">PutText</a></code>; the final value is returned by <code><a href="Test-HUnit-Text.html#v:runTestText">runTestText</a></code>. </p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:PutText" class="def">PutText</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -> st -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> st) st</td><td class="doc empty"> </td></tr></table></div></div><div class="top"><p class="src"><a name="v:putTextToHandle" class="def">putTextToHandle</a><a href="src/Test-HUnit-Text.html#putTextToHandle" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/GHC-IO-Handle.html#t:Handle">Handle</a></td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc"><p>Write progress lines to handle? </p></td></tr><tr><td class="src">-> <a href="Test-HUnit-Text.html#t:PutText">PutText</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Two reporting schemes are defined here. <code>putTextToHandle</code> writes report lines to a given handle. <code><a href="Test-HUnit-Text.html#v:putTextToShowS">putTextToShowS</a></code> accumulates persistent lines for return as a whole by <code><a href="Test-HUnit-Text.html#v:runTestText">runTestText</a></code>. </p><p><code>putTextToHandle</code> writes persistent lines to the given handle, following each by a newline character. In addition, if the given flag is <code>True</code>, it writes progress lines to the handle as well. A progress line is written with no line termination, so that it can be overwritten by the next report line. As overwriting involves writing carriage return and blank characters, its proper effect is usually only obtained on terminal devices. </p></div></div><div class="top"><p class="src"><a name="v:putTextToShowS" class="def">putTextToShowS</a> :: <a href="Test-HUnit-Text.html#t:PutText">PutText</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:ShowS">ShowS</a><a href="src/Test-HUnit-Text.html#putTextToShowS" class="link">Source</a></p><div class="doc"><p>Accumulates persistent lines (dropping progess lines) for return by <code><a href="Test-HUnit-Text.html#v:runTestText">runTestText</a></code>. The accumulated lines are represented by a <code><code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:ShowS">ShowS</a></code> (<code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></code> -> <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></code>)</code> function whose first argument is the string to be appended to the accumulated report lines. </p></div></div><div class="top"><p class="src"><a name="v:runTestText" class="def">runTestText</a> :: <a href="Test-HUnit-Text.html#t:PutText">PutText</a> st -> <a href="Test-HUnit-Base.html#t:Test">Test</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="Test-HUnit-Base.html#t:Counts">Counts</a>, st)<a href="src/Test-HUnit-Text.html#runTestText" class="link">Source</a></p><div class="doc"><p>Executes a test, processing each report line 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. </p></div></div><div class="top"><p class="src"><a name="v:showPath" class="def">showPath</a> :: <a href="Test-HUnit-Base.html#t:Path">Path</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a><a href="src/Test-HUnit-Text.html#showPath" class="link">Source</a></p><div class="doc"><p>Converts a test case path to a string, separating adjacent elements by the colon (':'). An element of the path is quoted (as with <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#v:show">show</a></code>) when there is potential ambiguity. </p></div></div><div class="top"><p class="src"><a name="v:showCounts" class="def">showCounts</a> :: <a href="Test-HUnit-Base.html#t:Counts">Counts</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a><a href="src/Test-HUnit-Text.html#showCounts" class="link">Source</a></p><div class="doc"><p>Converts test execution counts to a string. </p></div></div><div class="top"><p class="src"><a name="v:runTestTT" class="def">runTestTT</a> :: <a href="Test-HUnit-Base.html#t:Test">Test</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Test-HUnit-Base.html#t:Counts">Counts</a><a href="src/Test-HUnit-Text.html#runTestTT" class="link">Source</a></p><div class="doc"><p>Provides the "standard" text-based test controller. Reporting is made to standard error, and progress reports are included. For possible programmatic use, the final counts are returned. </p><p>The "TT" in the name suggests "Text-based reporting to the Terminal". </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>