-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | The Haskell Test Framework
--   
--   The Haskell Test Framework (<i>HTF</i> for short) lets you define unit
--   tests (<a>http://hunit.sourceforge.net</a>), QuickCheck properties
--   (<a>http://www.cs.chalmers.se/~rjmh/QuickCheck/</a>), and black box
--   tests in an easy and convenient way. HTF uses a custom preprocessor
--   that collects test definitions automatically. Furthermore, the
--   preprocessor allows HTF to report failing test cases with exact file
--   name and line number information. Additionally, HTF tries to produce
--   highly readable output for failing tests: for example, it colors and
--   pretty prints expected and actual results and provides a diff between
--   the two values.
--   
--   The documentation of the <a>Test.Framework.Tutorial</a> module
--   provides a tutorial for HTF. There is also a slightly out-dated blog
--   article
--   (<a>http://factisresearch.blogspot.de/2011/10/new-version-of-htf-with-diffs-colors.html</a>)
--   demonstrating HTF's coloring, pretty-printing and diff functionality.
@package HTF
@version 0.13.2.4

module Test.Framework.Colors
data Color
Color :: PrimColor -> Bool -> Color
data PrimColor
Black :: PrimColor
Blue :: PrimColor
Green :: PrimColor
Cyan :: PrimColor
Red :: PrimColor
Magenta :: PrimColor
Brown :: PrimColor
Gray :: PrimColor
DarkGray :: PrimColor
LightBlue :: PrimColor
LightGreen :: PrimColor
LightCyan :: PrimColor
LightRed :: PrimColor
LightMagenta :: PrimColor
Yellow :: PrimColor
White :: PrimColor
NoColor :: PrimColor
newtype ColorString
ColorString :: [PrimColorString] -> ColorString
[unColorString] :: ColorString -> [PrimColorString]
data PrimColorString
PrimColorString :: Color -> Text -> (Maybe Text) -> PrimColorString
firstDiffColor :: Color
secondDiffColor :: Color
skipDiffColor :: Color
diffColor :: Color
warningColor :: Color
testStartColor :: Color
testOkColor :: Color
pendingColor :: Color
emptyColorString :: ColorString
(+++) :: ColorString -> ColorString -> ColorString
infixr 5 +++
unlinesColorString :: [ColorString] -> ColorString
colorStringFind :: (Char -> Bool) -> ColorString -> Bool -> Maybe Char
ensureNewlineColorString :: ColorString -> ColorString
colorize :: Color -> String -> ColorString
colorizeText :: Color -> Text -> ColorString
colorize' :: Color -> String -> String -> ColorString
colorizeText' :: Color -> Text -> Text -> ColorString
noColor :: String -> ColorString
noColorText :: Text -> ColorString
noColor' :: String -> String -> ColorString
noColorText' :: Text -> Text -> ColorString
renderColorString :: ColorString -> Bool -> Text
maxLength :: ColorString -> Int
instance GHC.Read.Read Test.Framework.Colors.ColorString
instance GHC.Show.Show Test.Framework.Colors.ColorString
instance GHC.Classes.Eq Test.Framework.Colors.ColorString
instance GHC.Read.Read Test.Framework.Colors.PrimColorString
instance GHC.Show.Show Test.Framework.Colors.PrimColorString
instance GHC.Classes.Eq Test.Framework.Colors.PrimColorString
instance GHC.Read.Read Test.Framework.Colors.Color
instance GHC.Show.Show Test.Framework.Colors.Color
instance GHC.Classes.Eq Test.Framework.Colors.Color
instance GHC.Read.Read Test.Framework.Colors.PrimColor
instance GHC.Show.Show Test.Framework.Colors.PrimColor
instance GHC.Classes.Eq Test.Framework.Colors.PrimColor
instance Data.String.IsString Test.Framework.Colors.ColorString


-- | This module defines types and functions dealing with source code
--   locations.
module Test.Framework.Location

-- | An abstract type representing locations in a file.
data Location

-- | The unknown location (file <tt>?</tt> and line <tt>0</tt>).
unknownLocation :: Location

-- | Extract the file name of a <a>Location</a>.
fileName :: Location -> String

-- | Extract the line number of a <a>Location</a>.
lineNumber :: Location -> Int

-- | Render a <a>Location</a> as a <a>String</a>.
showLoc :: Location -> String

-- | Create a new location.
makeLoc :: String -> Int -> Location
instance GHC.Read.Read Test.Framework.Location.Location
instance GHC.Show.Show Test.Framework.Location.Location
instance GHC.Classes.Ord Test.Framework.Location.Location
instance GHC.Classes.Eq Test.Framework.Location.Location

module Test.Framework.Preprocessor
transform :: Bool -> Bool -> FilePath -> String -> IO String
progName :: String
preprocessorTests :: [([Char], IO ())]
instance GHC.Classes.Eq Test.Framework.Preprocessor.ModuleInfo
instance GHC.Show.Show Test.Framework.Preprocessor.ModuleInfo
instance GHC.Classes.Eq Test.Framework.Preprocessor.ImportDecl
instance GHC.Show.Show Test.Framework.Preprocessor.ImportDecl
instance GHC.Show.Show Test.Framework.Preprocessor.Definition
instance GHC.Classes.Eq Test.Framework.Preprocessor.Definition


-- | This module defines the <a>Pretty</a> type class. The assert functions
--   from <a>HUnitWrapper</a> use the pretty-printing functionality
--   provided by this type class so as to provide nicely formatted error
--   messages.
--   
--   Additionally, this module re-exports the standard Haskell
--   pretty-printing module <a>PrettyPrint</a>
module Test.Framework.Pretty

-- | A type class for pretty-printable things. Minimal complete definition:
--   <tt>pretty</tt>.
class Pretty a

-- | Pretty-print a single value.
pretty :: Pretty a => a -> Doc

-- | Pretty-print a list of things.
prettyList :: Pretty a => [a] -> Doc

-- | Pretty-print a single value as a <a>String</a>.
showPretty :: Pretty a => a -> String

-- | Utility function for inserting a <tt>=</tt> between two <a>Doc</a>
--   values.
(<=>) :: Doc -> Doc -> Doc
instance Test.Framework.Pretty.Pretty GHC.Types.Char
instance Test.Framework.Pretty.Pretty a => Test.Framework.Pretty.Pretty [a]
instance Test.Framework.Pretty.Pretty GHC.Types.Int
instance Test.Framework.Pretty.Pretty GHC.Types.Bool


-- | This module defines the API for HTF plugins.
module Test.Framework.TestInterface

-- | An assertion is just an <a>IO</a> action. Internally, the body of any
--   test in HTF is of type <a>Assertion</a>. If a test specification of a
--   certain plugin has a type different from <a>Assertion</a>, the
--   plugin's preprocessor pass must inject wrapper code to convert the
--   test specification into an assertion.
--   
--   Assertions may use <a>failHTF</a> to signal a <a>TestResult</a>
--   different from <a>Pass</a>. If the assertion finishes successfully,
--   the tests passes implicitly.
--   
--   Please note: the assertion must not swallow any exceptions! Otherwise,
--   timeouts and other things might not work as expected.
type Assertion = IO ()

-- | The summary result of a test.
data TestResult
Pass :: TestResult
Pending :: TestResult
Fail :: TestResult
Error :: TestResult

-- | The full result of a test, as used by HTF plugins.
data FullTestResult
FullTestResult :: Maybe Location -> [(Maybe String, Location)] -> Maybe ColorString -> Maybe TestResult -> FullTestResult

-- | The location of a possible failure
[ftr_location] :: FullTestResult -> Maybe Location

-- | The "stack" to the location of a possible failure
[ftr_callingLocations] :: FullTestResult -> [(Maybe String, Location)]

-- | An error message
[ftr_message] :: FullTestResult -> Maybe ColorString

-- | The outcome of the test, <a>Nothing</a> means timeout
[ftr_result] :: FullTestResult -> Maybe TestResult
data HTFFailureException
HTFFailure :: FullTestResult -> HTFFailureException

-- | Terminate a HTF test, usually to signal a failure. The result of the
--   test is given in the <a>FullTestResult</a> argument.
failHTF :: MonadBaseControl IO m => FullTestResult -> m a

-- | Opens a new assertion stack frame to allow for sensible location
--   information.
subAssertHTF :: MonadBaseControl IO m => Location -> Maybe String -> m a -> m a

-- | Auxiliary function for contructing a <a>FullTestResult</a>.
mkFullTestResult :: TestResult -> Maybe String -> FullTestResult
instance GHC.Show.Show Test.Framework.TestInterface.HTFFailureException
instance GHC.Read.Read Test.Framework.TestInterface.FullTestResult
instance GHC.Show.Show Test.Framework.TestInterface.FullTestResult
instance GHC.Classes.Eq Test.Framework.TestInterface.FullTestResult
instance GHC.Classes.Eq Test.Framework.TestInterface.TestResult
instance GHC.Read.Read Test.Framework.TestInterface.TestResult
instance GHC.Show.Show Test.Framework.TestInterface.TestResult
instance GHC.Exception.Exception Test.Framework.TestInterface.HTFFailureException

module Test.Framework.History
data TestHistory
data HistoricTestResult
HistoricTestResult :: !Text -> !TestResult -> !Bool -> !Milliseconds -> HistoricTestResult
[htr_testId] :: HistoricTestResult -> !Text
[htr_result] :: HistoricTestResult -> !TestResult
[htr_timedOut] :: HistoricTestResult -> !Bool
[htr_timeMs] :: HistoricTestResult -> !Milliseconds
emptyTestHistory :: TestHistory

-- | A type synonym for time in milliseconds.
type Milliseconds = Int

-- | The summary result of a test.
data TestResult
Pass :: TestResult
Pending :: TestResult
Fail :: TestResult
Error :: TestResult
serializeTestHistory :: TestHistory -> ByteString
deserializeTestHistory :: ByteString -> Either String (TestHistory)
findHistoricTestResult :: Text -> TestHistory -> Maybe (HistoricTestResult)
findHistoricSuccessfulTestResult :: Text -> TestHistory -> Maybe (HistoricTestResult)
updateTestHistory :: TestRunHistory -> TestHistory -> TestHistory
mkTestRunHistory :: UTCTime -> [HistoricTestResult] -> TestRunHistory
historyTests :: [([Char], IO ())]
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.History.HistoricTestResult
instance Data.Aeson.Types.FromJSON.FromJSON Test.Framework.History.HistoricTestResult
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.History.TestRunHistory
instance Data.Aeson.Types.FromJSON.FromJSON Test.Framework.History.TestRunHistory
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.History.SerializableTestHistory
instance Data.Aeson.Types.FromJSON.FromJSON Test.Framework.History.SerializableTestHistory
instance GHC.Classes.Eq Test.Framework.History.TestHistory
instance GHC.Classes.Eq Test.Framework.History.TestRunHistory
instance GHC.Classes.Eq Test.Framework.History.HistoricTestResult
instance GHC.Show.Show Test.Framework.History.HistoricTestResult
instance GHC.Show.Show Test.Framework.History.TestHistory
instance GHC.Show.Show Test.Framework.History.TestRunHistory
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.TestInterface.TestResult
instance Data.Aeson.Types.FromJSON.FromJSON Test.Framework.TestInterface.TestResult


-- | This module defines the <a>AssertM</a> monad, which allows you either
--   to run assertions as ordinary unit tests or to evaluate them as pure
--   functions.
module Test.Framework.AssertM

-- | A typeclass for generic assertions.
class Monad m => AssertM m
genericAssertFailure__ :: AssertM m => Location -> ColorString -> m a
genericSubAssert :: AssertM m => Location -> Maybe String -> m a -> m a

-- | Stack trace element for generic assertions.
data AssertStackElem
AssertStackElem :: Maybe String -> Maybe Location -> AssertStackElem
[ase_message] :: AssertStackElem -> Maybe String
[ase_location] :: AssertStackElem -> Maybe Location

-- | Type for evaluating a generic assertion as a pure function.
data AssertBool a

-- | Assertion passes successfully and yields the given value.
AssertOk :: a -> AssertBool a

-- | Assertion fails with the given stack trace. In the stack trace, the
--   outermost stackframe comes first.
AssertFailed :: [AssertStackElem] -> AssertBool a

-- | Evaluates a generic assertion to a <a>Bool</a> value.
boolValue :: AssertBool a -> Bool

-- | Evaluates a generic assertion to an <a>Either</a> value. The result is
--   <tt>Right x</tt> if the assertion passes and yields value <tt>x</tt>,
--   otherwise the result is <tt>Left err</tt>, where <tt>err</tt> is an
--   error message.
eitherValue :: AssertBool a -> Either String a

-- | Formats a stack trace.
formatStack :: [AssertStackElem] -> String
instance GHC.Read.Read a => GHC.Read.Read (Test.Framework.AssertM.AssertBool a)
instance GHC.Show.Show a => GHC.Show.Show (Test.Framework.AssertM.AssertBool a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.Framework.AssertM.AssertBool a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.Framework.AssertM.AssertBool a)
instance GHC.Read.Read Test.Framework.AssertM.AssertStackElem
instance GHC.Show.Show Test.Framework.AssertM.AssertStackElem
instance GHC.Classes.Ord Test.Framework.AssertM.AssertStackElem
instance GHC.Classes.Eq Test.Framework.AssertM.AssertStackElem
instance GHC.Base.Functor Test.Framework.AssertM.AssertBool
instance GHC.Base.Applicative Test.Framework.AssertM.AssertBool
instance GHC.Base.Monad Test.Framework.AssertM.AssertBool
instance Test.Framework.AssertM.AssertM Test.Framework.AssertM.AssertBool
instance Test.Framework.AssertM.AssertM GHC.Types.IO


-- | This module defines types (and small auxiliary functions) for
--   organizing tests, for configuring the execution of tests, and for
--   representing and reporting their results.
module Test.Framework.TestTypes

-- | Type for naming tests.
type TestID = String

-- | Abstract type for tests and their results.
data Test
BaseTest :: TestSort -> TestID -> (Maybe Location) -> TestOptions -> Assertion -> Test
CompoundTest :: TestSuite -> Test

-- | General options for tests
data TestOptions
TestOptions :: Bool -> TestOptions
[to_parallel] :: TestOptions -> Bool

-- | A type class for an assertion with <a>TestOptions</a>.
class AssertionWithTestOptions a
testOptions :: AssertionWithTestOptions a => a -> TestOptions
assertion :: AssertionWithTestOptions a => a -> Assertion

-- | Something with <a>TestOptions</a>
data WithTestOptions a
WithTestOptions :: TestOptions -> a -> WithTestOptions a
[wto_options] :: WithTestOptions a -> TestOptions
[wto_payload] :: WithTestOptions a -> a

-- | Abstract type for test suites and their results.
data TestSuite
TestSuite :: TestID -> [Test] -> TestSuite
AnonTestSuite :: [Test] -> TestSuite

-- | Type for distinguishing different sorts of tests.
data TestSort
UnitTest :: TestSort
QuickCheckTest :: TestSort
BlackBoxTest :: TestSort

-- | A type denoting the hierarchical name of a test.
data TestPath
TestPathBase :: TestID -> TestPath
TestPathCompound :: (Maybe TestID) -> TestPath -> TestPath

-- | Generic type for flattened tests and their results.
data GenFlatTest a
FlatTest :: TestSort -> TestPath -> Maybe Location -> a -> GenFlatTest a

-- | The sort of the test.
[ft_sort] :: GenFlatTest a -> TestSort

-- | Hierarchival path.
[ft_path] :: GenFlatTest a -> TestPath

-- | Place of definition.
[ft_location] :: GenFlatTest a -> Maybe Location

-- | A generic payload.
[ft_payload] :: GenFlatTest a -> a

-- | Flattened representation of tests.
type FlatTest = GenFlatTest (WithTestOptions Assertion)

-- | A filter is a predicate on <a>FlatTest</a>. If the predicate is
--   <a>True</a>, the flat test is run.
type TestFilter = FlatTest -> Bool

-- | Splits a <a>TestPath</a> into a list of test identifiers.
testPathToList :: TestPath -> [Maybe TestID]

-- | Creates a string representation from a <a>TestPath</a>.
flatName :: TestPath -> String

-- | Returns the final name of a <a>TestPath</a>
finalName :: TestPath -> String

-- | Returns the name of the prefix of a test path. The prefix is
--   everything except the last element.
prefixName :: TestPath -> String

-- | The default <a>TestOptions</a>
defaultTestOptions :: TestOptions

-- | Shortcut for constructing a <a>WithTestOptions</a> value.
withOptions :: (TestOptions -> TestOptions) -> a -> WithTestOptions a

-- | Key of a flat test for the history database.
historyKey :: GenFlatTest a -> Text

-- | The <a>TR</a> (test runner) monad.
type TR = RWST TestConfig () TestState IO

-- | The state type for the <a>TR</a> monad.
data TestState
TestState :: [FlatTestResult] -> Int -> TestState

-- | Results collected so far.
[ts_results] :: TestState -> [FlatTestResult]

-- | Current index for splitted output.
[ts_index] :: TestState -> Int

-- | The initial test state.
initTestState :: TestState

-- | Configuration of test execution.
data TestConfig
TestConfig :: Bool -> Maybe Int -> Bool -> TestOutput -> Maybe FilePath -> TestFilter -> [TestReporter] -> Bool -> FilePath -> TestHistory -> Bool -> Bool -> Bool -> Maybe Milliseconds -> Maybe Double -> Int -> TestConfig

-- | If set, displays messages only for failed tests.
[tc_quiet] :: TestConfig -> Bool

-- | Use <tt>Just i</tt> for parallel execution with <tt>i</tt> threads,
--   <tt>Nothing</tt> for sequential execution.
[tc_threads] :: TestConfig -> Maybe Int

-- | Shuffle tests before parallel execution
[tc_shuffle] :: TestConfig -> Bool

-- | Output destination of progress and result messages.
[tc_output] :: TestConfig -> TestOutput

-- | Output destination of XML result summary
[tc_outputXml] :: TestConfig -> Maybe FilePath

-- | Filter for the tests to run.
[tc_filter] :: TestConfig -> TestFilter

-- | Test reporters to use.
[tc_reporters] :: TestConfig -> [TestReporter]

-- | Whether to use colored output
[tc_useColors] :: TestConfig -> Bool

-- | Path to history file
[tc_historyFile] :: TestConfig -> FilePath

-- | History of previous test runs
[tc_history] :: TestConfig -> TestHistory

-- | Sort ascending by previous execution times
[tc_sortByPrevTime] :: TestConfig -> Bool

-- | Stop test run as soon as one test fails
[tc_failFast] :: TestConfig -> Bool

-- | Do not regard timeout as an error
[tc_timeoutIsSuccess] :: TestConfig -> Bool

-- | Maximum time in milliseconds a single test is allowed to run
[tc_maxSingleTestTime] :: TestConfig -> Maybe Milliseconds

-- | Maximum factor a single test is allowed to run slower than its
--   previous execution
[tc_prevFactor] :: TestConfig -> Maybe Double

-- | Number of times to repeat tests selected on the command line before
--   reporting them as a success.
[tc_repeat] :: TestConfig -> Int

-- | The destination of progress and result messages from HTF.
data TestOutput

-- | Output goes to <a>Handle</a>, boolean flag indicates whether the
--   handle should be closed at the end.
TestOutputHandle :: Handle -> Bool -> TestOutput

-- | Output goes to files whose names are derived from <a>FilePath</a> by
--   appending a number to it. Numbering starts at zero.
TestOutputSplitted :: FilePath -> TestOutput

-- | Reports the IDs of all tests available.
type ReportAllTests = [FlatTest] -> TR ()

-- | Signals that test execution is about to start.
type ReportGlobalStart = [FlatTest] -> TR ()

-- | Reports the start of a single test.
type ReportTestStart = FlatTest -> TR ()

-- | Reports the result of a single test.
type ReportTestResult = FlatTestResult -> TR ()

-- | Reports the overall results of all tests.
type ReportGlobalResults = ReportGlobalResultsArg -> TR ()
data ReportGlobalResultsArg
ReportGlobalResultsArg :: Milliseconds -> [FlatTestResult] -> [FlatTestResult] -> [FlatTestResult] -> [FlatTestResult] -> [FlatTestResult] -> [FlatTest] -> ReportGlobalResultsArg
[rgra_timeMs] :: ReportGlobalResultsArg -> Milliseconds
[rgra_passed] :: ReportGlobalResultsArg -> [FlatTestResult]
[rgra_pending] :: ReportGlobalResultsArg -> [FlatTestResult]
[rgra_failed] :: ReportGlobalResultsArg -> [FlatTestResult]
[rgra_errors] :: ReportGlobalResultsArg -> [FlatTestResult]
[rgra_timedOut] :: ReportGlobalResultsArg -> [FlatTestResult]
[rgra_filtered] :: ReportGlobalResultsArg -> [FlatTest]

-- | A <a>TestReporter</a> provides hooks to customize the output of HTF.
data TestReporter
TestReporter :: String -> ReportAllTests -> ReportGlobalStart -> ReportTestStart -> ReportTestResult -> ReportGlobalResults -> TestReporter
[tr_id] :: TestReporter -> String

-- | Called to report the IDs of all tests available.
[tr_reportAllTests] :: TestReporter -> ReportAllTests

-- | Called to report the start of test execution.
[tr_reportGlobalStart] :: TestReporter -> ReportGlobalStart

-- | Called to report the start of a single test.
[tr_reportTestStart] :: TestReporter -> ReportTestStart

-- | Called to report the result of a single test.
[tr_reportTestResult] :: TestReporter -> ReportTestResult

-- | Called to report the overall results of all tests.
[tr_reportGlobalResults] :: TestReporter -> ReportGlobalResults
emptyTestReporter :: String -> TestReporter
attachCallStack :: ColorString -> CallStack -> ColorString

-- | A type for call-stacks
type CallStack = [(Maybe String, Location)]

-- | The summary result of a test.
data TestResult
Pass :: TestResult
Pending :: TestResult
Fail :: TestResult
Error :: TestResult

-- | The result of running a <a>FlatTest</a>
type FlatTestResult = GenFlatTest RunResult

-- | A type synonym for time in milliseconds.
type Milliseconds = Int

-- | The result of a test run.
data RunResult
RunResult :: TestResult -> Maybe Location -> CallStack -> ColorString -> Milliseconds -> Bool -> RunResult

-- | The summary result of the test.
[rr_result] :: RunResult -> TestResult

-- | The location where the test failed (if applicable).
[rr_location] :: RunResult -> Maybe Location

-- | Information about the callers of the location where the test failed
[rr_callers] :: RunResult -> CallStack

-- | A message describing the result.
[rr_message] :: RunResult -> ColorString

-- | Execution time in milliseconds.
[rr_wallTimeMs] :: RunResult -> Milliseconds

-- | <a>True</a> if the execution took too long
[rr_timeout] :: RunResult -> Bool
instance GHC.Classes.Eq Test.Framework.TestTypes.TestOutput
instance GHC.Show.Show Test.Framework.TestTypes.TestOutput
instance GHC.Show.Show Test.Framework.TestTypes.TestPath
instance GHC.Read.Read a => GHC.Read.Read (Test.Framework.TestTypes.WithTestOptions a)
instance GHC.Show.Show a => GHC.Show.Show (Test.Framework.TestTypes.WithTestOptions a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.Framework.TestTypes.WithTestOptions a)
instance GHC.Read.Read Test.Framework.TestTypes.TestOptions
instance GHC.Show.Show Test.Framework.TestTypes.TestOptions
instance GHC.Classes.Eq Test.Framework.TestTypes.TestOptions
instance GHC.Read.Read Test.Framework.TestTypes.TestSort
instance GHC.Show.Show Test.Framework.TestTypes.TestSort
instance GHC.Classes.Eq Test.Framework.TestTypes.TestSort
instance GHC.Show.Show Test.Framework.TestTypes.TestConfig
instance GHC.Show.Show Test.Framework.TestTypes.TestReporter
instance GHC.Classes.Eq Test.Framework.TestTypes.TestReporter
instance Test.Framework.TestTypes.AssertionWithTestOptions (GHC.Types.IO a)
instance Test.Framework.TestTypes.AssertionWithTestOptions (Test.Framework.TestTypes.WithTestOptions (GHC.Types.IO a))


-- | HTF's machine-readable output is a sequence of JSON messages. Each
--   message is terminated by a newline followed by two semicolons followed
--   again by a newline.
--   
--   There are four types of JSON messages. Each JSON object has a "type"
--   attribute denoting this type. The types are: <tt>test-start</tt>,
--   <tt>test-end</tt>, and <tt>test-list</tt>, <tt>test-results</tt>.
--   Their haskell representations are <a>TestStartEventObj</a>,
--   <a>TestEndEventObj</a>, <a>TestListObj</a>, and <a>TestResultsObj</a>.
--   The corresponding JSON rendering is defined in this module.
--   
--   <ul>
--   <li>The <tt>test-start</tt> message denotes the start of a single test
--   case. Example (whitespace inserted for better readability):</li>
--   </ul>
--   
--   <pre>
--   {"test": {"flatName": "Main:nonEmpty",
--             "location": {"file": "Tutorial.hs", "line": 17},
--             "path": ["Main","nonEmpty"],
--             "sort": "unit-test"},
--    "type":"test-start"}
--   </pre>
--   
--   <ul>
--   <li>The <tt>test-end</tt> message denotes the end of a single test
--   case. It contains information about the outcome of the test.
--   Example:</li>
--   </ul>
--   
--   <pre>
--   {"result": "pass",
--    "message":"",
--    "test":{"flatName": "Main:nonEmpty",
--            "location": {"file": "Tutorial.hs", "line": 17},
--            "path": ["Main","nonEmpty"],
--            "sort": "unit-test"},
--    "wallTime": 0,  // in milliseconds
--    "type": "test-end",
--    "location":null}
--   </pre>
--   
--   <ul>
--   <li>The <tt>test-results</tt> message occurs after all tests have been
--   run and summarizes their results. Example:</li>
--   </ul>
--   
--   <pre>
--   {"failures": 0,
--    "passed": 4,
--    "pending": 0,
--    "wallTime": 39, // in milliseconds
--    "errors": 0,
--    "type":"test-results"}
--   </pre>
--   
--   <ul>
--   <li>The <tt>test-list</tt> message contains all tests defined. It is
--   used for the --list commandline options. Example:</li>
--   </ul>
--   
--   <pre>
--   {"tests": [{"flatName":"Main:nonEmpty","location":{"file":"Tutorial.hs","line":17},"path":["Main","nonEmpty"],"sort":"unit-test"},
--              {"flatName":"Main:empty","location":{"file":"Tutorial.hs","line":19},"path":["Main","empty"],"sort":"unit-test"},
--              {"flatName":"Main:reverse","location":{"file":"Tutorial.hs","line":22},"path":["Main","reverse"],"sort":"quickcheck-property"},
--              {"flatName":"Main:reverseReplay","location":{"file":"Tutorial.hs","line":24},"path":["Main","reverseReplay"],"sort":"quickcheck-property"}],
--    "type":"test-list"}
--   </pre>
--   
--   For an exact specification, please have a look at the code of this
--   module.
module Test.Framework.JsonOutput
data TestStartEventObj
data TestEndEventObj
data TestListObj
data TestObj
data TestResultsObj
mkTestStartEventObj :: FlatTest -> String -> TestStartEventObj
mkTestEndEventObj :: FlatTestResult -> String -> TestEndEventObj
mkTestListObj :: [(FlatTest, String)] -> TestListObj
mkTestResultsObj :: ReportGlobalResultsArg -> TestResultsObj
decodeObj :: HTFJsonObj a => a -> ByteString
class ToJSON a => HTFJsonObj a
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.JsonOutput.TestStartEventObj
instance Test.Framework.JsonOutput.HTFJsonObj Test.Framework.JsonOutput.TestStartEventObj
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.JsonOutput.TestEndEventObj
instance Test.Framework.JsonOutput.HTFJsonObj Test.Framework.JsonOutput.TestEndEventObj
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.JsonOutput.TestListObj
instance Test.Framework.JsonOutput.HTFJsonObj Test.Framework.JsonOutput.TestListObj
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.JsonOutput.TestObj
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.JsonOutput.TestResultsObj
instance Test.Framework.JsonOutput.HTFJsonObj Test.Framework.JsonOutput.TestResultsObj
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.TestTypes.TestPath
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.TestTypes.TestSort
instance Data.Aeson.Types.ToJSON.ToJSON Test.Framework.Location.Location

module Test.Framework.ThreadPool
type ThreadPoolEntry m a b = (m a, a -> IO b, Either SomeException b -> m StopFlag)
data ThreadPool m a b
ThreadPool :: ([ThreadPoolEntry m a b] -> m ()) -> ThreadPool m a b
[tp_run] :: ThreadPool m a b -> [ThreadPoolEntry m a b] -> m ()
data StopFlag
DoStop :: StopFlag
DoNotStop :: StopFlag
sequentialThreadPool :: MonadIO m => ThreadPool m a b
parallelThreadPool :: MonadIO m => Int -> m (ThreadPool m a b)
threadPoolTest :: (Int, Int) -> Int -> IO [()]
instance GHC.Read.Read Test.Framework.ThreadPool.StopFlag
instance GHC.Show.Show Test.Framework.ThreadPool.StopFlag
instance GHC.Classes.Eq Test.Framework.ThreadPool.StopFlag
instance GHC.Show.Show (Test.Framework.ThreadPool.WorkResult m b)
instance GHC.Show.Show (Test.Framework.ThreadPool.WorkItem m b)


-- | This module provides a short tutorial on how to use the HTF. It
--   assumes that you are using GHC for compiling your Haskell code. (It is
--   possible to use the HTF with other Haskell environments, only the
--   steps taken to invoke the custom preprocessor of the HTF may differ in
--   this case.)
--   
--   We start with a simple example. Then we show how to use HTF to easily
--   collect test definitions from multiple modules and discuss
--   backwards-compatibility for projects already using <tt>HUnit</tt>.
--   Finally, we give a brief cookbook-like summary on how to setup your
--   tests with HTF.
module Test.Framework.Tutorial


-- | This module integrates the <a>QuickCheck</a> library into HTF. It
--   re-exports all functionality of <a>QuickCheck</a> and defines some
--   additional functions.
module Test.Framework.QuickCheckWrapper

-- | The <a>Args</a> used if not explicitly changed.
defaultArgs :: Args

-- | Retrieve the <a>Args</a> currently used per default when evaluating
--   quick check properties.
getCurrentArgs :: IO Args

-- | Change the default <a>Args</a> used to evaluate quick check
--   properties.
setDefaultArgs :: Args -> IO ()

-- | Run a <a>QuickCheck</a> property with modified quick check arguments
--   <a>Args</a>.
withQCArgs :: (Testable a) => (Args -> Args) -> a -> WithQCArgs a

-- | Abstract type for representing quick check properties with custom
--   <a>Args</a>. Used only internally.
data WithQCArgs a

-- | Sets the <a>replay</a> parameter of the <a>Args</a> datatype by
--   parsing the given string.
setReplayFromString :: Args -> String -> Args

-- | Type class providing access to the custom <a>Args</a> of a quick check
--   property. Used only internally.
class QCAssertion a

-- | Use <tt>qcPending msg prop</tt> to mark the given quick check property
--   as pending without removing it from the test suite and without
--   deleting or commenting out the property code.
qcPending :: Testable t => String -> t -> t
assertionAsProperty :: IO () -> Property

-- | Turns a <a>QuickCheck</a> property into an <a>Assertion</a>. This
--   function is used internally in the code generated by <tt>htfpp</tt>,
--   do not use it directly.
qcAssertion :: (QCAssertion t) => t -> Assertion
instance GHC.Classes.Eq Test.Framework.QuickCheckWrapper.QCPendingException
instance GHC.Read.Read Test.Framework.QuickCheckWrapper.QCPendingException
instance GHC.Show.Show Test.Framework.QuickCheckWrapper.QCPendingException
instance Test.QuickCheck.Property.Testable a => Test.Framework.QuickCheckWrapper.QCAssertion a
instance Test.QuickCheck.Property.Testable a => Test.Framework.QuickCheckWrapper.QCAssertion (Test.Framework.QuickCheckWrapper.WithQCArgs a)
instance GHC.Exception.Exception Test.Framework.QuickCheckWrapper.QCPendingException

module Test.Framework.PrettyHaskell
prettyHaskell :: Show a => a -> String
prettyHaskell' :: Show a => a -> Maybe String
prettyHaskellTests :: [([Char], IO ())]
instance GHC.Show.Show Test.Framework.PrettyHaskell.MySuperSuperHero
instance GHC.Show.Show Test.Framework.PrettyHaskell.MySuperHero


-- | This module provides assert-like functions for writing unit tests.
--   
--   <i>Hint:</i> Do not use the <tt>assertXXX_</tt> functions directly.
--   Instead, for each function <tt>assertXXX_</tt>, there exist a
--   preprocessor macro <tt>assertXXX</tt>, which provides the
--   <a>Location</a> parameter automatically. Use these macros, which are
--   available automatically if you add
--   
--   <pre>
--   {-# OPTIONS_GHC -F -pgmF htfpp #-}
--   </pre>
--   
--   at the top of your source file (see the <a>Tutorial</a>).
module Test.Framework.HUnitWrapper
assertBool_ :: Location -> Bool -> IO ()
assertBoolVerbose_ :: Location -> String -> Bool -> IO ()
gassertBool_ :: AssertM m => Location -> Bool -> m ()

-- | Fail if the <a>Bool</a> value is <a>False</a>. The <a>String</a>
--   parameter in the <tt>Verbose</tt> variants can be used to provide
--   extra information about the error. The variants <tt>gassertBool</tt>
--   and <tt>gassertBoolVerbose</tt> are generic assertions: they run in
--   the IO monad and can be evaluated to a <a>Bool</a> value. Do not use
--   the <tt>assertBool_</tt>, <tt>assertBoolVerbose_</tt>,
--   <tt>gassertBool_</tt>, and <tt>gassertBoolVerbose_</tt> functions
--   directly, use the macros <tt>assertBool</tt>,
--   <tt>assertBoolVerbose</tt>, <tt>gassertBool</tt>, and
--   <tt>gassertBoolVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
gassertBoolVerbose_ :: AssertM m => Location -> String -> Bool -> m ()
assertEqual_ :: (Eq a, Show a) => Location -> a -> a -> IO ()
assertEqualVerbose_ :: (Eq a, Show a) => Location -> String -> a -> a -> IO ()
gassertEqual_ :: (Eq a, Show a, AssertM m) => Location -> a -> a -> m ()

-- | Fail if the two values of type <tt>a</tt> are not equal. The first
--   parameter denotes the expected value. Use these two functions of
--   <tt>a</tt> is an instance of <a>Show</a> but not of <a>Pretty</a>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variants can be used
--   to provide extra information about the error. The variants
--   <tt>gassertEqual</tt> and <tt>gassertEqualVerbose</tt> are generic
--   assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertEqual_</tt>,
--   <tt>assertEqualVerbose_</tt>, <tt>gassertEqual_</tt>, and
--   <tt>gassertEqualVerbose_</tt> functions directly, use the macros
--   <tt>assertEqual</tt>, <tt>assertEqualVerbose</tt>,
--   <tt>gassertEqual</tt>, and <tt>gassertEqualVerbose</tt> instead. These
--   macros, provided by the <tt>htfpp</tt> preprocessor, insert the
--   <a>Location</a> parameter automatically.
gassertEqualVerbose_ :: (Eq a, Show a, AssertM m) => Location -> String -> a -> a -> m ()
assertEqualPretty_ :: (Eq a, Pretty a) => Location -> a -> a -> IO ()
assertEqualPrettyVerbose_ :: (Eq a, Pretty a) => Location -> String -> a -> a -> IO ()
gassertEqualPretty_ :: (Eq a, Pretty a, AssertM m) => Location -> a -> a -> m ()

-- | Fail if the two values of type <tt>a</tt> are not equal. The first
--   parameter denotes the expected value. Use these two functions of
--   <tt>a</tt> is an instance of <a>Pretty</a>. The <a>String</a>
--   parameter in the <tt>Verbose</tt> variants can be used to provide
--   extra information about the error. The variants
--   <tt>gassertEqualPretty</tt> and <tt>gassertEqualPrettyVerbose</tt> are
--   generic assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertEqualPretty_</tt>,
--   <tt>assertEqualPrettyVerbose_</tt>, <tt>gassertEqualPretty_</tt>, and
--   <tt>gassertEqualPrettyVerbose_</tt> functions directly, use the macros
--   <tt>assertEqualPretty</tt>, <tt>assertEqualPrettyVerbose</tt>,
--   <tt>gassertEqualPretty</tt>, and <tt>gassertEqualPrettyVerbose</tt>
--   instead. These macros, provided by the <tt>htfpp</tt> preprocessor,
--   insert the <a>Location</a> parameter automatically.
gassertEqualPrettyVerbose_ :: (Eq a, Pretty a, AssertM m) => Location -> String -> a -> a -> m ()
assertEqualNoShow_ :: Eq a => Location -> a -> a -> IO ()
assertEqualNoShowVerbose_ :: Eq a => Location -> String -> a -> a -> IO ()
gassertEqualNoShow_ :: (Eq a, AssertM m) => Location -> a -> a -> m ()

-- | Fail if the two values of type <tt>a</tt> are not equal. The first
--   parameter denotes the expected value. Use these two functions of
--   <tt>a</tt> is neither an instance of <a>Show</a> nor <a>Pretty</a>. Be
--   aware that in this case the generated error message might not be very
--   helpful. The <a>String</a> parameter in the <tt>Verbose</tt> variants
--   can be used to provide extra information about the error. The variants
--   <tt>gassertEqualNoShow</tt> and <tt>gassertEqualNoShowVerbose</tt> are
--   generic assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertEqualNoShow_</tt>,
--   <tt>assertEqualNoShowVerbose_</tt>, <tt>gassertEqualNoShow_</tt>, and
--   <tt>gassertEqualNoShowVerbose_</tt> functions directly, use the macros
--   <tt>assertEqualNoShow</tt>, <tt>assertEqualNoShowVerbose</tt>,
--   <tt>gassertEqualNoShow</tt>, and <tt>gassertEqualNoShowVerbose</tt>
--   instead. These macros, provided by the <tt>htfpp</tt> preprocessor,
--   insert the <a>Location</a> parameter automatically.
gassertEqualNoShowVerbose_ :: (Eq a, AssertM m) => Location -> String -> a -> a -> m ()
assertNotEqual_ :: (Eq a, Show a) => Location -> a -> a -> IO ()
assertNotEqualVerbose_ :: (Eq a, Show a) => Location -> String -> a -> a -> IO ()
gassertNotEqual_ :: (Eq a, Show a, AssertM m) => Location -> a -> a -> m ()

-- | Fail if the two values of type <tt>a</tt> are equal. The first
--   parameter denotes the expected value. Use these two functions of
--   <tt>a</tt> is an instance of <a>Show</a> but not of <a>Pretty</a>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variants can be used
--   to provide extra information about the error. The variants
--   <tt>gassertNotEqual</tt> and <tt>gassertNotEqualVerbose</tt> are
--   generic assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertNotEqual_</tt>,
--   <tt>assertNotEqualVerbose_</tt>, <tt>gassertNotEqual_</tt>, and
--   <tt>gassertNotEqualVerbose_</tt> functions directly, use the macros
--   <tt>assertNotEqual</tt>, <tt>assertNotEqualVerbose</tt>,
--   <tt>gassertNotEqual</tt>, and <tt>gassertNotEqualVerbose</tt> instead.
--   These macros, provided by the <tt>htfpp</tt> preprocessor, insert the
--   <a>Location</a> parameter automatically.
gassertNotEqualVerbose_ :: (Eq a, Show a, AssertM m) => Location -> String -> a -> a -> m ()
assertNotEqualPretty_ :: (Eq a, Pretty a) => Location -> a -> a -> IO ()
assertNotEqualPrettyVerbose_ :: (Eq a, Pretty a) => Location -> String -> a -> a -> IO ()
gassertNotEqualPretty_ :: (Eq a, Pretty a, AssertM m) => Location -> a -> a -> m ()

-- | Fail if the two values of type <tt>a</tt> are equal. The first
--   parameter denotes the expected value. Use these two functions of
--   <tt>a</tt> is an instance of <a>Pretty</a>. The <a>String</a>
--   parameter in the <tt>Verbose</tt> variants can be used to provide
--   extra information about the error. The variants
--   <tt>gassertNotEqualPretty</tt> and
--   <tt>gassertNotEqualPrettyVerbose</tt> are generic assertions: they run
--   in the IO monad and can be evaluated to a <a>Bool</a> value. Do not
--   use the <tt>assertNotEqualPretty_</tt>,
--   <tt>assertNotEqualPrettyVerbose_</tt>,
--   <tt>gassertNotEqualPretty_</tt>, and
--   <tt>gassertNotEqualPrettyVerbose_</tt> functions directly, use the
--   macros <tt>assertNotEqualPretty</tt>,
--   <tt>assertNotEqualPrettyVerbose</tt>, <tt>gassertNotEqualPretty</tt>,
--   and <tt>gassertNotEqualPrettyVerbose</tt> instead. These macros,
--   provided by the <tt>htfpp</tt> preprocessor, insert the
--   <a>Location</a> parameter automatically.
gassertNotEqualPrettyVerbose_ :: (Eq a, Pretty a, AssertM m) => Location -> String -> a -> a -> m ()
assertNotEqualNoShow_ :: Eq a => Location -> a -> a -> IO ()
assertNotEqualNoShowVerbose_ :: Eq a => Location -> String -> a -> a -> IO ()
gassertNotEqualNoShow_ :: (Eq a, AssertM m) => Location -> a -> a -> m ()

-- | Fail if the two values of type <tt>a</tt> are equal. The first
--   parameter denotes the expected value. Use these two functions of
--   <tt>a</tt> is neither an instance of <a>Show</a> nor <a>Pretty</a>. Be
--   aware that in this case the generated error message might not be very
--   helpful. The <a>String</a> parameter in the <tt>Verbose</tt> variants
--   can be used to provide extra information about the error. The variants
--   <tt>gassertNotEqualNoShow</tt> and
--   <tt>gassertNotEqualNoShowVerbose</tt> are generic assertions: they run
--   in the IO monad and can be evaluated to a <a>Bool</a> value. Do not
--   use the <tt>assertNotEqualNoShow_</tt>,
--   <tt>assertNotEqualNoShowVerbose_</tt>,
--   <tt>gassertNotEqualNoShow_</tt>, and
--   <tt>gassertNotEqualNoShowVerbose_</tt> functions directly, use the
--   macros <tt>assertNotEqualNoShow</tt>,
--   <tt>assertNotEqualNoShowVerbose</tt>, <tt>gassertNotEqualNoShow</tt>,
--   and <tt>gassertNotEqualNoShowVerbose</tt> instead. These macros,
--   provided by the <tt>htfpp</tt> preprocessor, insert the
--   <a>Location</a> parameter automatically.
gassertNotEqualNoShowVerbose_ :: (Eq a, AssertM m) => Location -> String -> a -> a -> m ()
assertListsEqualAsSets_ :: (Eq a, Show a) => Location -> [a] -> [a] -> IO ()
assertListsEqualAsSetsVerbose_ :: (Eq a, Show a) => Location -> String -> [a] -> [a] -> IO ()
gassertListsEqualAsSets_ :: (Eq a, Show a, AssertM m) => Location -> [a] -> [a] -> m ()

-- | Fail if the two given lists are not equal when considered as sets. The
--   first list parameter denotes the expected value. The <a>String</a>
--   parameter in the <tt>Verbose</tt> variants can be used to provide
--   extra information about the error. The variants
--   <tt>gassertListsEqualAsSets</tt> and
--   <tt>gassertListsEqualAsSetsVerbose</tt> are generic assertions: they
--   run in the IO monad and can be evaluated to a <a>Bool</a> value. Do
--   not use the <tt>assertListsEqualAsSets_</tt>,
--   <tt>assertListsEqualAsSetsVerbose_</tt>,
--   <tt>gassertListsEqualAsSets_</tt>, and
--   <tt>gassertListsEqualAsSetsVerbose_</tt> functions directly, use the
--   macros <tt>assertListsEqualAsSets</tt>,
--   <tt>assertListsEqualAsSetsVerbose</tt>,
--   <tt>gassertListsEqualAsSets</tt>, and
--   <tt>gassertListsEqualAsSetsVerbose</tt> instead. These macros,
--   provided by the <tt>htfpp</tt> preprocessor, insert the
--   <a>Location</a> parameter automatically.
gassertListsEqualAsSetsVerbose_ :: (Eq a, Show a, AssertM m) => Location -> String -> [a] -> [a] -> m ()
assertNotEmpty_ :: Location -> [a] -> IO ()
assertNotEmptyVerbose_ :: Location -> String -> [a] -> IO ()
gassertNotEmpty_ :: AssertM m => Location -> [a] -> m ()

-- | Fail if the given list is empty. The <a>String</a> parameter in the
--   <tt>Verbose</tt> variants can be used to provide extra information
--   about the error. The variants <tt>gassertNotEmpty</tt> and
--   <tt>gassertNotEmptyVerbose</tt> are generic assertions: they run in
--   the IO monad and can be evaluated to a <a>Bool</a> value. Do not use
--   the <tt>assertNotEmpty_</tt>, <tt>assertNotEmptyVerbose_</tt>,
--   <tt>gassertNotEmpty_</tt>, and <tt>gassertNotEmptyVerbose_</tt>
--   functions directly, use the macros <tt>assertNotEmpty</tt>,
--   <tt>assertNotEmptyVerbose</tt>, <tt>gassertNotEmpty</tt>, and
--   <tt>gassertNotEmptyVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
gassertNotEmptyVerbose_ :: AssertM m => Location -> String -> [a] -> m ()
assertEmpty_ :: Location -> [a] -> IO ()
assertEmptyVerbose_ :: Location -> String -> [a] -> IO ()
gassertEmpty_ :: AssertM m => Location -> [a] -> m ()

-- | Fail if the given list is a non-empty list. The <a>String</a>
--   parameter in the <tt>Verbose</tt> variants can be used to provide
--   extra information about the error. The variants <tt>gassertEmpty</tt>
--   and <tt>gassertEmptyVerbose</tt> are generic assertions: they run in
--   the IO monad and can be evaluated to a <a>Bool</a> value. Do not use
--   the <tt>assertEmpty_</tt>, <tt>assertEmptyVerbose_</tt>,
--   <tt>gassertEmpty_</tt>, and <tt>gassertEmptyVerbose_</tt> functions
--   directly, use the macros <tt>assertEmpty</tt>,
--   <tt>assertEmptyVerbose</tt>, <tt>gassertEmpty</tt>, and
--   <tt>gassertEmptyVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
gassertEmptyVerbose_ :: AssertM m => Location -> String -> [a] -> m ()
assertElem_ :: (Eq a, Show a) => Location -> a -> [a] -> IO ()
assertElemVerbose_ :: (Eq a, Show a) => Location -> String -> a -> [a] -> IO ()
gassertElem_ :: (Eq a, Show a, AssertM m) => Location -> a -> [a] -> m ()

-- | Fail if the given element is not in the list. The <a>String</a>
--   parameter in the <tt>Verbose</tt> variants can be used to provide
--   extra information about the error. The variants <tt>gassertElem</tt>
--   and <tt>gassertElemVerbose</tt> are generic assertions: they run in
--   the IO monad and can be evaluated to a <a>Bool</a> value. Do not use
--   the <tt>assertElem_</tt>, <tt>assertElemVerbose_</tt>,
--   <tt>gassertElem_</tt>, and <tt>gassertElemVerbose_</tt> functions
--   directly, use the macros <tt>assertElem</tt>,
--   <tt>assertElemVerbose</tt>, <tt>gassertElem</tt>, and
--   <tt>gassertElemVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
gassertElemVerbose_ :: (Eq a, Show a, AssertM m) => Location -> String -> a -> [a] -> m ()
assertThrows_ :: Exception e => Location -> a -> (e -> Bool) -> IO ()

-- | Fail if evaluating the expression of type <tt>a</tt> does not throw an
--   exception satisfying the given predicate <tt>(e -&gt; Bool)</tt>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variant can be used to
--   provide extra information about the error. Do not use the
--   <tt>assertThrows_</tt> and <tt>assertThrowsVerbose_</tt> functions
--   directly, use the macros <tt>assertThrows</tt> and
--   <tt>assertThrowsVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
assertThrowsVerbose_ :: Exception e => Location -> String -> a -> (e -> Bool) -> IO ()
assertThrowsSome_ :: Location -> a -> IO ()

-- | Fail if evaluating the expression of type <tt>a</tt> does not throw an
--   exception. The <a>String</a> parameter in the <tt>Verbose</tt> variant
--   can be used to provide extra information about the error. Do not use
--   the <tt>assertThrowsSome_</tt> and <tt>assertThrowsSomeVerbose_</tt>
--   functions directly, use the macros <tt>assertThrowsSome</tt> and
--   <tt>assertThrowsSomeVerbose</tt> instead. These macros, provided by
--   the <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
assertThrowsSomeVerbose_ :: Location -> String -> a -> IO ()
assertThrowsIO_ :: Exception e => Location -> IO a -> (e -> Bool) -> IO ()

-- | Fail if executing the <a>IO</a> action does not throw an exception
--   satisfying the given predicate <tt>(e -&gt; Bool)</tt>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variant can be used to
--   provide extra information about the error. Do not use the
--   <tt>assertThrowsIO_</tt> and <tt>assertThrowsIOVerbose_</tt> functions
--   directly, use the macros <tt>assertThrowsIO</tt> and
--   <tt>assertThrowsIOVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
assertThrowsIOVerbose_ :: Exception e => Location -> String -> IO a -> (e -> Bool) -> IO ()
assertThrowsSomeIO_ :: Location -> IO a -> IO ()

-- | Fail if executing the <a>IO</a> action does not throw an exception.
--   The <a>String</a> parameter in the <tt>Verbose</tt> variant can be
--   used to provide extra information about the error. Do not use the
--   <tt>assertThrowsSomeIO_</tt> and <tt>assertThrowsSomeIOVerbose_</tt>
--   functions directly, use the macros <tt>assertThrowsSomeIO</tt> and
--   <tt>assertThrowsSomeIOVerbose</tt> instead. These macros, provided by
--   the <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
assertThrowsSomeIOVerbose_ :: Location -> String -> IO a -> IO ()
assertThrowsM_ :: (MonadBaseControl IO m, MonadIO m, Exception e) => Location -> m a -> (e -> Bool) -> m ()

-- | Fail if executing the <tt>m</tt> action does not throw an exception
--   satisfying the given predicate <tt>(e -&gt; Bool)</tt>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variant can be used to
--   provide extra information about the error. Do not use the
--   <tt>assertThrowsM_</tt> and <tt>assertThrowsMVerbose_</tt> functions
--   directly, use the macros <tt>assertThrowsM</tt> and
--   <tt>assertThrowsMVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
assertThrowsMVerbose_ :: (MonadBaseControl IO m, MonadIO m, Exception e) => Location -> String -> m a -> (e -> Bool) -> m ()
assertThrowsSomeM_ :: (MonadBaseControl IO m, MonadIO m) => Location -> m a -> m ()

-- | Fail if executing the <tt>m</tt> action does not throw an exception.
--   The <a>String</a> parameter in the <tt>Verbose</tt> variant can be
--   used to provide extra information about the error. Do not use the
--   <tt>assertThrowsSomeM_</tt> and <tt>assertThrowsSomeMVerbose_</tt>
--   functions directly, use the macros <tt>assertThrowsSomeM</tt> and
--   <tt>assertThrowsSomeMVerbose</tt> instead. These macros, provided by
--   the <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
assertThrowsSomeMVerbose_ :: (MonadBaseControl IO m, MonadIO m) => Location -> String -> m a -> m ()
assertLeft_ :: Show b => Location -> Either a b -> IO a
assertLeftVerbose_ :: Show b => Location -> String -> Either a b -> IO a
gassertLeft_ :: (Show b, AssertM m) => Location -> Either a b -> m a

-- | Fail if the given <tt>Either a b</tt> value is a <a>Right</a>. Use
--   this function if <tt>b</tt> is an instance of <a>Show</a> The
--   <a>String</a> parameter in the <tt>Verbose</tt> variants can be used
--   to provide extra information about the error. The variants
--   <tt>gassertLeft</tt> and <tt>gassertLeftVerbose</tt> are generic
--   assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertLeft_</tt>,
--   <tt>assertLeftVerbose_</tt>, <tt>gassertLeft_</tt>, and
--   <tt>gassertLeftVerbose_</tt> functions directly, use the macros
--   <tt>assertLeft</tt>, <tt>assertLeftVerbose</tt>, <tt>gassertLeft</tt>,
--   and <tt>gassertLeftVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
gassertLeftVerbose_ :: (Show b, AssertM m) => Location -> String -> Either a b -> m a
assertLeftNoShow_ :: Location -> Either a b -> IO a
assertLeftNoShowVerbose_ :: Location -> String -> Either a b -> IO a
gassertLeftNoShow_ :: AssertM m => Location -> Either a b -> m a

-- | Fail if the given <tt>Either a b</tt> value is a <a>Right</a>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variants can be used
--   to provide extra information about the error. The variants
--   <tt>gassertLeftNoShow</tt> and <tt>gassertLeftNoShowVerbose</tt> are
--   generic assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertLeftNoShow_</tt>,
--   <tt>assertLeftNoShowVerbose_</tt>, <tt>gassertLeftNoShow_</tt>, and
--   <tt>gassertLeftNoShowVerbose_</tt> functions directly, use the macros
--   <tt>assertLeftNoShow</tt>, <tt>assertLeftNoShowVerbose</tt>,
--   <tt>gassertLeftNoShow</tt>, and <tt>gassertLeftNoShowVerbose</tt>
--   instead. These macros, provided by the <tt>htfpp</tt> preprocessor,
--   insert the <a>Location</a> parameter automatically.
gassertLeftNoShowVerbose_ :: AssertM m => Location -> String -> Either a b -> m a
assertRight_ :: Show a => Location -> Either a b -> IO b
assertRightVerbose_ :: Show a => Location -> String -> Either a b -> IO b
gassertRight_ :: (Show a, AssertM m) => Location -> Either a b -> m b

-- | Fail if the given <tt>Either a b</tt> value is a <a>Left</a>. Use this
--   function if <tt>a</tt> is an instance of <a>Show</a> The <a>String</a>
--   parameter in the <tt>Verbose</tt> variants can be used to provide
--   extra information about the error. The variants <tt>gassertRight</tt>
--   and <tt>gassertRightVerbose</tt> are generic assertions: they run in
--   the IO monad and can be evaluated to a <a>Bool</a> value. Do not use
--   the <tt>assertRight_</tt>, <tt>assertRightVerbose_</tt>,
--   <tt>gassertRight_</tt>, and <tt>gassertRightVerbose_</tt> functions
--   directly, use the macros <tt>assertRight</tt>,
--   <tt>assertRightVerbose</tt>, <tt>gassertRight</tt>, and
--   <tt>gassertRightVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
gassertRightVerbose_ :: (Show a, AssertM m) => Location -> String -> Either a b -> m b
assertRightNoShow_ :: Location -> Either a b -> IO b
assertRightNoShowVerbose_ :: Location -> String -> Either a b -> IO b
gassertRightNoShow_ :: AssertM m => Location -> Either a b -> m b

-- | Fail if the given <tt>Either a b</tt> value is a <a>Left</a>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variants can be used
--   to provide extra information about the error. The variants
--   <tt>gassertRightNoShow</tt> and <tt>gassertRightNoShowVerbose</tt> are
--   generic assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertRightNoShow_</tt>,
--   <tt>assertRightNoShowVerbose_</tt>, <tt>gassertRightNoShow_</tt>, and
--   <tt>gassertRightNoShowVerbose_</tt> functions directly, use the macros
--   <tt>assertRightNoShow</tt>, <tt>assertRightNoShowVerbose</tt>,
--   <tt>gassertRightNoShow</tt>, and <tt>gassertRightNoShowVerbose</tt>
--   instead. These macros, provided by the <tt>htfpp</tt> preprocessor,
--   insert the <a>Location</a> parameter automatically.
gassertRightNoShowVerbose_ :: AssertM m => Location -> String -> Either a b -> m b
assertJust_ :: Location -> Maybe a -> IO a
assertJustVerbose_ :: Location -> String -> Maybe a -> IO a
gassertJust_ :: AssertM m => Location -> Maybe a -> m a

-- | Fail is the given <tt>Maybe a</tt> value is a <a>Nothing</a>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variants can be used
--   to provide extra information about the error. The variants
--   <tt>gassertJust</tt> and <tt>gassertJustVerbose</tt> are generic
--   assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertJust_</tt>,
--   <tt>assertJustVerbose_</tt>, <tt>gassertJust_</tt>, and
--   <tt>gassertJustVerbose_</tt> functions directly, use the macros
--   <tt>assertJust</tt>, <tt>assertJustVerbose</tt>, <tt>gassertJust</tt>,
--   and <tt>gassertJustVerbose</tt> instead. These macros, provided by the
--   <tt>htfpp</tt> preprocessor, insert the <a>Location</a> parameter
--   automatically.
gassertJustVerbose_ :: AssertM m => Location -> String -> Maybe a -> m a
assertNothing_ :: Show a => Location -> Maybe a -> IO ()
assertNothingVerbose_ :: Show a => Location -> String -> Maybe a -> IO ()
gassertNothing_ :: (Show a, AssertM m) => Location -> Maybe a -> m ()

-- | Fail is the given <tt>Maybe a</tt> value is a <a>Just</a>. Use this
--   function if <tt>a</tt> is an instance of <a>Show</a>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variants can be used
--   to provide extra information about the error. The variants
--   <tt>gassertNothing</tt> and <tt>gassertNothingVerbose</tt> are generic
--   assertions: they run in the IO monad and can be evaluated to a
--   <a>Bool</a> value. Do not use the <tt>assertNothing_</tt>,
--   <tt>assertNothingVerbose_</tt>, <tt>gassertNothing_</tt>, and
--   <tt>gassertNothingVerbose_</tt> functions directly, use the macros
--   <tt>assertNothing</tt>, <tt>assertNothingVerbose</tt>,
--   <tt>gassertNothing</tt>, and <tt>gassertNothingVerbose</tt> instead.
--   These macros, provided by the <tt>htfpp</tt> preprocessor, insert the
--   <a>Location</a> parameter automatically.
gassertNothingVerbose_ :: (Show a, AssertM m) => Location -> String -> Maybe a -> m ()
assertNothingNoShow_ :: Location -> Maybe a -> IO ()
assertNothingNoShowVerbose_ :: Location -> String -> Maybe a -> IO ()
gassertNothingNoShow_ :: AssertM m => Location -> Maybe a -> m ()

-- | Fail is the given <tt>Maybe a</tt> value is a <a>Just</a>. The
--   <a>String</a> parameter in the <tt>Verbose</tt> variants can be used
--   to provide extra information about the error. The variants
--   <tt>gassertNothingNoShow</tt> and <tt>gassertNothingNoShowVerbose</tt>
--   are generic assertions: they run in the IO monad and can be evaluated
--   to a <a>Bool</a> value. Do not use the <tt>assertNothingNoShow_</tt>,
--   <tt>assertNothingNoShowVerbose_</tt>, <tt>gassertNothingNoShow_</tt>,
--   and <tt>gassertNothingNoShowVerbose_</tt> functions directly, use the
--   macros <tt>assertNothingNoShow</tt>,
--   <tt>assertNothingNoShowVerbose</tt>, <tt>gassertNothingNoShow</tt>,
--   and <tt>gassertNothingNoShowVerbose</tt> instead. These macros,
--   provided by the <tt>htfpp</tt> preprocessor, insert the
--   <a>Location</a> parameter automatically.
gassertNothingNoShowVerbose_ :: AssertM m => Location -> String -> Maybe a -> m ()

-- | Specialization of <tt>gassertFailure</tt>.
assertFailure_ :: Location -> String -> IO a

-- | Fail with the given reason, supplying the error location and the error
--   message.
gassertFailure_ :: AssertM m => Location -> String -> m a

-- | Signals that the current unit test is pending.
unitTestPending :: String -> IO a

-- | Use <tt>unitTestPending' msg test</tt> to mark the given test as
--   pending without removing it from the test suite and without deleting
--   or commenting out the test code.
unitTestPending' :: String -> IO a -> IO a

-- | Sub assertions are a poor man's way of abstracting over assertions
--   while still propagating location information. Say you want to abstract
--   over the assertion that an <a>Int</a> is positive. You would write
--   
--   <pre>
--   assertIsPositive :: Int -&gt; Assertion
--   assertIsPositive n = assertBool (n &gt; 0)
--   </pre>
--   
--   You can now use <tt>assertIsPositive i</tt> for some integer
--   <tt>i</tt> from your unit tests, but if you call it directly you will
--   lose location information: if <tt>assertIsPositive i</tt> fails you
--   will only get the location where <tt>assertIsPositive</tt> is defined
--   but not from where it has been called.
--   
--   To recover the location information you simply use <tt>subAssert
--   (assertIsPositive i)</tt>. In this case, if <tt>i</tt> is not
--   positive, you will get the location of the caller.
--   
--   <i>Note:</i> Don't use subAssert_ directly but use the preprocessor
--   macro <tt>subAssert</tt>.
subAssert_ :: MonadBaseControl IO m => Location -> m a -> m a

-- | Same as <a>subAssert_</a> but with an additional error message.
subAssertVerbose_ :: MonadBaseControl IO m => Location -> String -> m a -> m a

-- | Generic variant of <a>subAssert_</a>.
gsubAssert_ :: AssertM m => Location -> m a -> m a

-- | Generic variant of <a>subAssertVerbose_</a>.
gsubAssertVerbose_ :: AssertM m => Location -> String -> m a -> m a
data HUnitFailure :: *
hunitWrapperTests :: [([Char], IO ())]


-- | See
--   <a>http://pzolee.blogs.balabit.com/2012/11/jenkins-vs-junit-xml-format/</a>
--   for a description of the format used.
--   
--   The source code of this module also contains a rough specification of
--   the output format in terms of Haskell data types.
module Test.Framework.XmlOutput
mkGlobalResultsXml :: ReportGlobalResultsArg -> ByteString


-- | This module defines functions for notifying all test reporters
--   registered about particular events in the lifecycle of a test run.
--   
--   Further, it defines the standard test reporters for HTF's various
--   output formats.
module Test.Framework.TestReporter
data IsParallel
Parallel :: IsParallel
NonParallel :: IsParallel
isParallelFromBool :: Bool -> IsParallel
data IsJsonOutput
JsonOutput :: IsJsonOutput
NoJsonOutput :: IsJsonOutput
data IsXmlOutput
XmlOutput :: IsXmlOutput
NoXmlOutput :: IsXmlOutput

-- | Invokes <a>tr_reportAllTests</a> on all test reporters registered.
reportAllTests :: ReportAllTests

-- | Invokes <a>tr_reportGlobalStart</a> on all test reporters registered.
reportGlobalStart :: ReportGlobalStart

-- | Invokes <a>tr_reportTestStart</a> on all test reporters registered.
reportTestStart :: ReportTestStart

-- | Invokes <a>tr_reportTestResult</a> on all test reporters registered.
reportTestResult :: ReportTestResult

-- | Invokes <a>tr_reportGlobalResults</a> on all test reporters
--   registered.
reportGlobalResults :: ReportGlobalResults

-- | The default test reporters for HTF.
defaultTestReporters :: IsParallel -> IsJsonOutput -> IsXmlOutput -> [TestReporter]
instance GHC.Classes.Ord Test.Framework.TestReporter.ReportLevel
instance GHC.Classes.Eq Test.Framework.TestReporter.ReportLevel


-- | This module defines the commandline options of the test driver
--   provided by HTF.
module Test.Framework.CmdlineOptions

-- | Commandline options for running tests.
data CmdlineOptions
CmdlineOptions :: Bool -> TestFilter -> Bool -> [String] -> Maybe Int -> Bool -> Bool -> Maybe FilePath -> Maybe Bool -> Maybe FilePath -> Bool -> Bool -> Maybe FilePath -> Bool -> Bool -> Maybe Milliseconds -> Maybe Milliseconds -> Maybe Double -> Bool -> Int -> CmdlineOptions

-- | Be quiet or not.
[opts_quiet] :: CmdlineOptions -> Bool

-- | Run only tests matching this filter.
[opts_filter] :: CmdlineOptions -> TestFilter

-- | If <a>True</a>, display a help message and exit.
[opts_help] :: CmdlineOptions -> Bool

-- | Regular expressions matching test names which should <i>not</i> run.
[opts_negated] :: CmdlineOptions -> [String]

-- | Use <tt>Just i</tt> for parallel execution with <tt>i</tt> threads,
--   <tt>Nothing</tt> for sequential execution.
[opts_threads] :: CmdlineOptions -> Maybe Int

-- | If <a>True</a>, shuffle tests when running them in parallel. Default:
--   <a>False</a>
[opts_shuffle] :: CmdlineOptions -> Bool

-- | Format output for machines (JSON format) or humans. See
--   <a>JsonOutput</a> for a definition of the JSON format.
[opts_machineOutput] :: CmdlineOptions -> Bool

-- | Output file for junit-style XML output. See <a>XmlOutput</a> for a
--   definition of the XML format.
[opts_machineOutputXml] :: CmdlineOptions -> Maybe FilePath

-- | Use <tt>Just b</tt> to enable/disable use of colors, <tt>Nothing</tt>
--   infers the use of colors.
[opts_useColors] :: CmdlineOptions -> Maybe Bool

-- | The output file, defaults to stdout
[opts_outputFile] :: CmdlineOptions -> Maybe FilePath

-- | If <a>True</a>, lists all tests available and exits.
[opts_listTests] :: CmdlineOptions -> Bool

-- | If <a>True</a>, each message is sent to a new ouput file (derived by
--   appending an index to <a>opts_outputFile</a>).
[opts_split] :: CmdlineOptions -> Bool

-- | History file, default: <tt>.<i>.HTF</i><a>ProgramName</a>.history</tt>
[opts_historyFile] :: CmdlineOptions -> Maybe FilePath

-- | Fail and terminate test run as soon as the first test fails. Default:
--   <a>False</a>
[opts_failFast] :: CmdlineOptions -> Bool

-- | Sort tests by their previous run times (ascending). Default:
--   <a>False</a>
[opts_sortByPrevTime] :: CmdlineOptions -> Bool

-- | Ignore tests with a runtime greater than given in a previous test run.
[opts_maxPrevTimeMs] :: CmdlineOptions -> Maybe Milliseconds

-- | Abort tests that run more than the given milliseconds.
[opts_maxCurTimeMs] :: CmdlineOptions -> Maybe Milliseconds

-- | Warn if a test runs more than N times slower than in a previous run.
[opts_prevFactor] :: CmdlineOptions -> Maybe Double

-- | Do not regard test timeout as an error.
[opts_timeoutIsSuccess] :: CmdlineOptions -> Bool

-- | Number of times to repeat tests selected on the command line before
--   reporting them as a success.
[opts_repeat] :: CmdlineOptions -> Int

-- | The default <a>CmdlineOptions</a>.
defaultCmdlineOptions :: CmdlineOptions

-- | Parse commandline arguments into <a>CmdlineOptions</a>. Here is a
--   synopsis of the format of the commandline arguments:
--   
--   <pre>
--   USAGE: COMMAND [OPTION ...] PATTERN ...
--   
--     where PATTERN is a posix regular expression matching
--     the names of the tests to run.
--   
--     -q          --quiet                     Only display errors.
--     -n PATTERN  --not=PATTERN               Tests to exclude.
--     -l          --list                      List all matching tests.
--     -j[N]       --threads[=N]               Run N tests in parallel, default N=1.
--                 --shuffle=BOOL              Shuffle test order. Default: false
--     -o FILE     --output-file=FILE          Name of output file.
--                 --json                      Output results in machine-readable JSON format (incremental).
--                 --xml=FILE                  Output results in junit-style XML format.
--                 --split                     Splits results in separate files to avoid file locking (requires -o/--output-file).
--                 --colors=BOOL               Use colors or not.
--                 --history=FILE              Path to the history file. Default: ./.HTF/&lt;ProgramName&gt;.history
--                 --fail-fast                 Fail and abort test run as soon as the first test fails.
--                 --sort-by-prev-time         Sort tests ascending by their execution of the previous test run (if available). Default: false
--                 --max-prev-ms=MILLISECONDS  Do not try to execute tests that had a execution time greater than MILLISECONDS in a previous test run.
--                 --max-cur-ms=MILLISECONDS   Abort a test that runs more than MILLISECONDS.
--                 --prev-factor=DOUBLE        Abort a test that runs more than DOUBLE times slower than in a previous run.
--                 --timeout-is-success        Do not regard a test timeout as an error.
--     -h          --help                      Display this message.
--   </pre>
parseTestArgs :: [String] -> Either String CmdlineOptions

-- | The string displayed for the <tt>--help</tt> option.
helpString :: String

-- | Turn the <a>CmdlineOptions</a> into a <a>TestConfig</a>.
testConfigFromCmdlineOptions :: CmdlineOptions -> IO TestConfig


-- | This module defines function for running a set of tests. Furthermore,
--   it provides functionality for organzing tests into a hierarchical
--   structure. This functionality is mainly used internally in the code
--   generated by the <tt>hftpp</tt> pre-processor.
module Test.Framework.TestManager

-- | Runs something testable by parsing the commandline arguments as test
--   options (using <a>parseTestArgs</a>). Exits with the exit code
--   returned by <a>runTestWithArgs</a>. This function is the main entry
--   point for running tests.
htfMain :: TestableHTF t => t -> IO ()

-- | Runs something testable by parsing the commandline arguments as test
--   options (using <a>parseTestArgs</a>). Exits with the exit code
--   returned by <a>runTestWithArgs</a>.
htfMainWithArgs :: TestableHTF t => [String] -> t -> IO ()

-- | Run something testable using the <a>defaultCmdlineOptions</a>.
runTest :: TestableHTF t => t -> IO ExitCode

-- | Run something testable using the <a>defaultCmdlineOptions</a>.
runTest' :: TestableHTF t => t -> IO (IO (), ExitCode)

-- | Run something testable, parse the <a>CmdlineOptions</a> from the given
--   commandline arguments. Does not print the overall test results but
--   returns an <a>IO</a> action for doing so.
runTestWithArgs :: TestableHTF t => [String] -> t -> IO ExitCode

-- | Run something testable, parse the <a>CmdlineOptions</a> from the given
--   commandline arguments.
runTestWithArgs' :: TestableHTF t => [String] -> t -> IO (IO (), ExitCode)

-- | Runs something testable with the given <a>CmdlineOptions</a>. See
--   <a>runTestWithConfig</a> for a specification of the <a>ExitCode</a>
--   result.
runTestWithOptions :: TestableHTF t => CmdlineOptions -> t -> IO ExitCode

-- | Runs something testable with the given <a>CmdlineOptions</a>. Does not
--   print the overall test results but returns an <a>IO</a> action for
--   doing so. See <a>runTestWithConfig</a> for a specification of the
--   <a>ExitCode</a> result.
runTestWithOptions' :: TestableHTF t => CmdlineOptions -> t -> IO (IO (), ExitCode)

-- | Runs something testable with the given <a>TestConfig</a>. The result
--   is <a>ExitSuccess</a> if all tests were executed successfully,
--   <a>ExitFailure</a> otherwise. In the latter case, an error code of
--   <tt>1</tt> indicates that failures but no errors occurred, otherwise
--   the error code <tt>2</tt> is used.
--   
--   A test is <i>successful</i> if the test terminates and no assertion
--   fails. A test is said to <i>fail</i> if an assertion fails but no
--   other error occur.
runTestWithConfig :: TestableHTF t => TestConfig -> t -> IO (ExitCode, TestHistory)

-- | Runs something testable with the given <a>TestConfig</a>. Does not
--   print the overall test results but returns an <a>IO</a> action for
--   doing so. See <a>runTestWithConfig</a> for a specification of the
--   <a>ExitCode</a> result.
runTestWithConfig' :: TestableHTF t => TestConfig -> t -> IO (IO (), ExitCode, TestHistory)

-- | A type class for things that can be run as tests. Mainly used
--   internally.
class TestableHTF t

-- | Kind of specialised <a>Functor</a> type class for tests, which allows
--   you to modify the <a>Assertion</a>s of the <a>WrappableHTF</a>-thing
--   without changing any test code.
--   
--   E.g. if you want to add timeouts to all tests of a module, you could
--   write:
--   
--   <pre>
--   addTimeout test = timeout 100 test &gt;&gt;= assertJustVerbose "Timeout exceeded"
--   testsWithTimeouts = wrap addTimeout htf_thisModulesTests
--   </pre>
class WrappableHTF t
wrap :: WrappableHTF t => (Assertion -> Assertion) -> t -> t

-- | Construct a test where the given <a>Assertion</a> checks a quick check
--   property. Mainly used internally by the htfpp preprocessor.
makeQuickCheckTest :: TestID -> Location -> Assertion -> Test

-- | Construct a unit test from the given <a>IO</a> action. Mainly used
--   internally by the htfpp preprocessor.
makeUnitTest :: AssertionWithTestOptions a => TestID -> Location -> a -> Test

-- | Construct a black box test from the given <a>Assertion</a>. Mainly
--   used internally.
makeBlackBoxTest :: TestID -> Assertion -> Test

-- | Create a named <a>TestSuite</a> from a list of <a>Test</a> values.
makeTestSuite :: TestID -> [Test] -> TestSuite

-- | Create an unnamed <a>TestSuite</a> from a list of <a>Test</a> values.
makeAnonTestSuite :: [Test] -> TestSuite

-- | Extend a <a>TestSuite</a> with a list of <a>Test</a> values
addToTestSuite :: TestSuite -> [Test] -> TestSuite

-- | Turn a <a>TestSuite</a> into a proper <a>Test</a>.
testSuiteAsTest :: TestSuite -> Test
flattenTest :: Test -> [FlatTest]
wrappableTests :: [([Char], IO ())]
instance Test.Framework.TestManager.TestableHTF Test.Framework.TestTypes.Test
instance Test.Framework.TestManager.TestableHTF Test.Framework.TestTypes.TestSuite
instance Test.Framework.TestManager.TestableHTF t => Test.Framework.TestManager.TestableHTF [t]
instance Test.Framework.TestManager.TestableHTF (GHC.Types.IO a)
instance Test.Framework.TestManager.WrappableHTF Test.Framework.TestTypes.TestSuite
instance Test.Framework.TestManager.WrappableHTF Test.Framework.TestTypes.Test


-- | A <i>black box test</i> in the terminology of the HTF consists of a
--   driver program that is run in various input files. For each input
--   file, the HTF checks that the driver program exits with the correct
--   exit code and that it produces the expected output. The samples
--   directory of the HTF source tree shows an example for a black box
--   test, see <a>https://github.com/skogsbaer/HTF/tree/master/sample</a>.
--   
--   <i>NOTE:</i> If you use black box tests, you have to compile your
--   program with the <tt>-threaded</tt> option. Otherwise, your program
--   just blocks indefinitely!
module Test.Framework.BlackBoxTest

-- | Use a value of this datatype to customize various aspects of your
--   black box tests.
data BBTArgs
BBTArgs :: String -> String -> String -> String -> Bool -> Diff -> Diff -> BBTArgs

-- | File extension for the file used as stdin.
[bbtArgs_stdinSuffix] :: BBTArgs -> String

-- | File extension for the file specifying expected output on stdout.
[bbtArgs_stdoutSuffix] :: BBTArgs -> String

-- | File extension for the file specifying expected output on stderr.
[bbtArgs_stderrSuffix] :: BBTArgs -> String

-- | Name of a file defining various arguments for executing the tests
--   contained in a subdirectory of the test hierarchy. If a directory
--   contains a such-named file, the arguments apply to all testfiles
--   directly contained in this directory. See the documentation of
--   <a>blackBoxTests</a> for a specification of the argument file format.
--   Default: BBTArgs
[bbtArgs_dynArgsName] :: BBTArgs -> String

-- | Be verbose or not.
[bbtArgs_verbose] :: BBTArgs -> Bool

-- | Diff program for comparing output on stdout with the expected value.
[bbtArgs_stdoutDiff] :: BBTArgs -> Diff

-- | Diff program for comparing output on stderr with the expected value.
[bbtArgs_stderrDiff] :: BBTArgs -> Diff

-- | Sensible default values for <a>BBTArgs</a>:
--   
--   <pre>
--   defaultBBTArgs = BBTArgs { bbtArgs_stdinSuffix    = ".in"
--                            , bbtArgs_stdoutSuffix   = ".out"
--                            , bbtArgs_stderrSuffix   = ".err"
--                            , bbtArgs_dynArgsName    = "BBTArgs"
--                            , bbtArgs_stdoutDiff     = defaultDiff
--                            , bbtArgs_stderrDiff     = defaultDiff
--                            , bbtArgs_verbose        = False }
--   </pre>
defaultBBTArgs :: BBTArgs

-- | Collects all black box tests with the given file extension stored in a
--   specific directory. For example, the invocation
--   
--   <pre>
--   blackBoxTests "bbt-dir" "dist/build/sample/sample" ".num" defaultBBTArgs
--   </pre>
--   
--   returns a list of <a>Test</a> values, one <a>Test</a> for each
--   <tt>.num</tt> file found in <tt>bbt-dir</tt> and its subdirectories.
--   (The samples directory of the HTF source tree contains the example
--   shown here, see
--   <a>https://github.com/skogsbaer/HTF/tree/master/sample</a>.)
--   
--   Suppose that one of the <tt>.num</tt> files is
--   <tt>bbt-dir/should-pass/x.num</tt>. Running the corresponding
--   <a>Test</a> invokes <tt>dist/build/sample/sample</tt> (the program
--   under test) with <tt>bbt-dir/should-pass/x.num</tt> as the last
--   commandline argument. The other commandline arguments are taken from
--   the flags specification given in the file whose name is stored in the
--   <a>bbtArgs_dynArgsName</a> field of the <a>BBTArgs</a> record (see
--   below, default is BBTArgs).
--   
--   If <tt>bbt-dir/should-pass/x.in</tt> existed, its content would be
--   used as stdin. The tests succeeds if the exit code of the program is
--   zero and the output on stdout and stderr matches the contents of
--   <tt>bbt-dir/should-pass/x.out</tt> and
--   <tt>bbt-dir/should-pass/x.err</tt>, respectively. If
--   <tt>bbt-dir/should-pass/x.out</tt> and
--   <tt>bbt-dir/should-pass/x.err</tt> do not exist, then output is not
--   checked.
--   
--   The <a>bbtArgs_dynArgsName</a> field of the <a>BBTArgs</a> record
--   specifies a filename that contains some more configuration flags for
--   the tests. The following flags (separated by newlines) are supported:
--   
--   <ul>
--   <li><i><tt>Skip</tt></i> Skips all tests in the same directory as the
--   argument file.</li>
--   <li><i><tt>Fail</tt></i> Specify that the test should succeed if it
--   exits with a non-zero exit code.</li>
--   <li><i><tt>Flags: flags</tt></i> Passes the given <tt>flags</tt> to
--   the program under test.</li>
--   </ul>
blackBoxTests :: FilePath -> String -> String -> BBTArgs -> IO [Test]

-- | The type of a function comparing the content of a file against a
--   string, similar to the unix tool <tt>diff</tt>. The first parameter is
--   the name of the file containing the expected output. If this parameter
--   is <a>Nothing</a>, then output should not be checked. The second
--   parameter is the actual output produced. If the result is
--   <a>Nothing</a> then no difference was found. Otherwise, a <a>Just</a>
--   value contains a string explaining the difference.
type Diff = Maybe FilePath -> String -> IO (Maybe String)

-- | A default value for the <a>Diff</a> datatype that simple resorts to
--   the <tt>diff</tt> commandline utility.
defaultDiff :: Diff


-- | Top-level module that re-exports functionality from sub-modules.
--   Modules that only define unit tests and quickcheck properties
--   typically only need to import this module. Your test driver should
--   additionally import <a>TestManager</a> and, if needed,
--   <a>BlackBoxTest</a>.
module Test.Framework

-- | Construct a unit test from the given <a>IO</a> action. Mainly used
--   internally by the htfpp preprocessor.
makeUnitTest :: AssertionWithTestOptions a => TestID -> Location -> a -> Test

-- | Construct a test where the given <a>Assertion</a> checks a quick check
--   property. Mainly used internally by the htfpp preprocessor.
makeQuickCheckTest :: TestID -> Location -> Assertion -> Test

-- | Create a named <a>TestSuite</a> from a list of <a>Test</a> values.
makeTestSuite :: TestID -> [Test] -> TestSuite

-- | Abstract type for test suites and their results.
data TestSuite

-- | Runs something testable by parsing the commandline arguments as test
--   options (using <a>parseTestArgs</a>). Exits with the exit code
--   returned by <a>runTestWithArgs</a>. This function is the main entry
--   point for running tests.
htfMain :: TestableHTF t => t -> IO ()

-- | Runs something testable by parsing the commandline arguments as test
--   options (using <a>parseTestArgs</a>). Exits with the exit code
--   returned by <a>runTestWithArgs</a>.
htfMainWithArgs :: TestableHTF t => [String] -> t -> IO ()

-- | Create a new location.
makeLoc :: String -> Int -> Location

-- | Run something testable using the <a>defaultCmdlineOptions</a>.
runTest :: TestableHTF t => t -> IO ExitCode

-- | Kind of specialised <a>Functor</a> type class for tests, which allows
--   you to modify the <a>Assertion</a>s of the <a>WrappableHTF</a>-thing
--   without changing any test code.
--   
--   E.g. if you want to add timeouts to all tests of a module, you could
--   write:
--   
--   <pre>
--   addTimeout test = timeout 100 test &gt;&gt;= assertJustVerbose "Timeout exceeded"
--   testsWithTimeouts = wrap addTimeout htf_thisModulesTests
--   </pre>
class WrappableHTF t
wrap :: WrappableHTF t => (Assertion -> Assertion) -> t -> t
