<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >Test.HUnit.Text</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_Test-HUnit-Text.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >HUnit-1.2.2.1: A unit testing framework for Haskell</TD ><TD CLASS="topbut" ><A HREF="src/Test-HUnit-Text.html" >Source code</A ></TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >Test.HUnit.Text</FONT ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" >Text-based test controller for running HUnit tests and reporting results as text, usually to a terminal. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3APutText" >PutText</A > st = <A HREF="#v%3APutText" >PutText</A > (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A > -> st -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > st) st</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AputTextToHandle" >putTextToHandle</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle.html#t%3AHandle" >Handle</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A > -> <A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AputTextToShowS" >putTextToShowS</A > :: <A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShowS" >ShowS</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArunTestText" >runTestText</A > :: <A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A > st -> <A HREF="Test-HUnit-Base.html#t%3ATest" >Test</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > (<A HREF="Test-HUnit-Base.html#t%3ACounts" >Counts</A >, st)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AshowPath" >showPath</A > :: <A HREF="Test-HUnit-Base.html#t%3APath" >Path</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AshowCounts" >showCounts</A > :: <A HREF="Test-HUnit-Base.html#t%3ACounts" >Counts</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArunTestTT" >runTestTT</A > :: <A HREF="Test-HUnit-Base.html#t%3ATest" >Test</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="Test-HUnit-Base.html#t%3ACounts" >Counts</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Documentation</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:PutText" ><A NAME="t%3APutText" ></A ></A ><B >PutText</B > st </TD ><TD CLASS="declbut" ><A HREF="src/Test-HUnit-Text.html#PutText" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" ><P >As the general text-based test controller (<TT ><A HREF="Test-HUnit-Text.html#v%3ArunTestText" >runTestText</A ></TT >) 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 <TT ><A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A ></TT >. A report string is known as a "line", although it includes no line terminator; the function in a <TT ><A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A ></TT > is responsible for terminating lines appropriately. Besides the line, the function receives a flag indicating the intended "persistence" of the line: <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#v%3ATrue" >True</A ></TT > indicates that the line should be part of the final overall report; <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#v%3AFalse" >False</A ></TT > 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 <TT ><A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A ></TT > function is also passed, and returns, an arbitrary state value (called st here). The initial state value is given in the <TT ><A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A ></TT >; the final value is returned by <TT ><A HREF="Test-HUnit-Text.html#v%3ArunTestText" >runTestText</A ></TT >. </P ></TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:PutText" ><A NAME="v%3APutText" ></A ></A ><B >PutText</B > (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A > -> st -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > st) st</TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:putTextToHandle" ><A NAME="v%3AputTextToHandle" ></A ></A ><B >putTextToHandle</B ></TD ><TD CLASS="declbut" ><A HREF="src/Test-HUnit-Text.html#putTextToHandle" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle.html#t%3AHandle" >Handle</A ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ><TD CLASS="rdoc" >Write progress lines to handle? </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" ><P >Two reporting schemes are defined here. <TT >putTextToHandle</TT > writes report lines to a given handle. <TT ><A HREF="Test-HUnit-Text.html#v%3AputTextToShowS" >putTextToShowS</A ></TT > accumulates persistent lines for return as a whole by <TT ><A HREF="Test-HUnit-Text.html#v%3ArunTestText" >runTestText</A ></TT >. </P ><P ><TT >putTextToHandle</TT > writes persistent lines to the given handle, following each by a newline character. In addition, if the given flag is <TT >True</TT >, 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 ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:putTextToShowS" ><A NAME="v%3AputTextToShowS" ></A ></A ><B >putTextToShowS</B > :: <A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShowS" >ShowS</A ></TD ><TD CLASS="declbut" ><A HREF="src/Test-HUnit-Text.html#putTextToShowS" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Accumulates persistent lines (dropping progess lines) for return by <TT ><A HREF="Test-HUnit-Text.html#v%3ArunTestText" >runTestText</A ></TT >. The accumulated lines are represented by a <TT ><TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShowS" >ShowS</A ></TT > (<TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TT > -> <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TT >)</TT > function whose first argument is the string to be appended to the accumulated report lines. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:runTestText" ><A NAME="v%3ArunTestText" ></A ></A ><B >runTestText</B > :: <A HREF="Test-HUnit-Text.html#t%3APutText" >PutText</A > st -> <A HREF="Test-HUnit-Base.html#t%3ATest" >Test</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > (<A HREF="Test-HUnit-Base.html#t%3ACounts" >Counts</A >, st)</TD ><TD CLASS="declbut" ><A HREF="src/Test-HUnit-Text.html#runTestText" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >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. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:showPath" ><A NAME="v%3AshowPath" ></A ></A ><B >showPath</B > :: <A HREF="Test-HUnit-Base.html#t%3APath" >Path</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="declbut" ><A HREF="src/Test-HUnit-Text.html#showPath" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Converts a test case path to a string, separating adjacent elements by the colon (':'). An element of the path is quoted (as with <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#v%3Ashow" >show</A ></TT >) when there is potential ambiguity. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:showCounts" ><A NAME="v%3AshowCounts" ></A ></A ><B >showCounts</B > :: <A HREF="Test-HUnit-Base.html#t%3ACounts" >Counts</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="declbut" ><A HREF="src/Test-HUnit-Text.html#showCounts" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Converts test execution counts to a string. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:runTestTT" ><A NAME="v%3ArunTestTT" ></A ></A ><B >runTestTT</B > :: <A HREF="Test-HUnit-Base.html#t%3ATest" >Test</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="Test-HUnit-Base.html#t%3ACounts" >Counts</A ></TD ><TD CLASS="declbut" ><A HREF="src/Test-HUnit-Text.html#runTestTT" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >