HTF-0.15.0.2: The Haskell Test Framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Framework

Description

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. Test drivers should additionally import TestManager and, if needed, BlackBoxTest.

See Test.Framework.Tutorial for a description how to use HTF.

Synopsis

Unit tests

makeUnitTest :: AssertionWithTestOptions a => TestID -> Location -> a -> Test Source #

Construct a unit test from the given IO action. Mainly used internally by the htfpp preprocessor.

Quickcheck

makeQuickCheckTest :: TestID -> Location -> Assertion -> Test Source #

Construct a test where the given Assertion checks a quick check property. Mainly used internally by the htfpp preprocessor.

Generic assertions

Organizing tests

makeTestSuite :: TestID -> [Test] -> TestSuite Source #

Create a named TestSuite from a list of Test values.

data TestSuite Source #

Abstract type for test suites and their results.

Instances

Instances details
TestableHTF TestSuite Source # 
Instance details

Defined in Test.Framework.TestManager

Methods

flatten :: TestSuite -> [FlatTest]

WrappableHTF TestSuite Source # 
Instance details

Defined in Test.Framework.TestManager

htfMain :: TestableHTF t => t -> IO () Source #

Runs something testable by parsing the commandline arguments as test options (using parseTestArgs). Exits with the exit code returned by runTestWithArgs. This function is the main entry point for running tests.

htfMainWithArgs :: TestableHTF t => [String] -> t -> IO () Source #

Runs something testable by parsing the commandline arguments as test options (using parseTestArgs). Exits with the exit code returned by runTestWithArgs.

makeLoc Source #

Arguments

:: String

The file name

-> Int

The line number

-> Location 

Create a new location.

runTest Source #

Arguments

:: TestableHTF t 
=> t

Testable thing

-> IO ExitCode

See runTestWithOptions for a specification of the ExitCode result

Run something testable using the defaultCmdlineOptions.

class WrappableHTF t where Source #

Kind of specialised Functor type class for tests, which allows you to modify the Assertions of the WrappableHTF-thing without changing any test code.

E.g. if you want to add timeouts to all tests of a module, you could write:

addTimeout test = timeout 100 test >>= assertJustVerbose "Timeout exceeded"
testsWithTimeouts = wrap addTimeout htf_thisModulesTests

Methods

wrap :: (Assertion -> Assertion) -> t -> t Source #

Instances

Instances details
WrappableHTF Test Source # 
Instance details

Defined in Test.Framework.TestManager

Methods

wrap :: (Assertion -> Assertion) -> Test -> Test Source #

WrappableHTF TestSuite Source # 
Instance details

Defined in Test.Framework.TestManager