Safe Haskell | None |
---|
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 hftpp
pre-processor.
- module Test.Framework.TestTypes
- htfMain :: TestableHTF t => t -> IO ()
- runTest :: TestableHTF t => t -> IO ExitCode
- runTest' :: TestableHTF t => t -> IO (IO (), ExitCode)
- runTestWithArgs :: TestableHTF t => [String] -> t -> IO ExitCode
- runTestWithArgs' :: TestableHTF t => [String] -> t -> IO (IO (), ExitCode)
- runTestWithOptions :: TestableHTF t => CmdlineOptions -> t -> IO ExitCode
- runTestWithOptions' :: TestableHTF t => CmdlineOptions -> t -> IO (IO (), ExitCode)
- runTestWithConfig :: TestableHTF t => TestConfig -> t -> IO ExitCode
- runTestWithConfig' :: TestableHTF t => TestConfig -> t -> IO (IO (), ExitCode)
- class TestableHTF t
- makeQuickCheckTest :: TestID -> Location -> Assertion -> Test
- makeUnitTest :: AssertionWithTestOptions a => TestID -> Location -> a -> Test
- makeBlackBoxTest :: TestID -> Assertion -> Test
- makeTestSuite :: TestID -> [Test] -> TestSuite
- makeAnonTestSuite :: [Test] -> TestSuite
- addToTestSuite :: TestSuite -> [Test] -> TestSuite
- testSuiteAsTest :: TestSuite -> Test
Re-exports
module Test.Framework.TestTypes
Running tests
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.
:: TestableHTF t | |
=> t | Testable thing |
-> IO ExitCode | See |
Run something testable using the defaultCmdlineOptions
.
:: TestableHTF t | |
=> t | Testable thing |
-> IO (IO (), ExitCode) |
|
Run something testable using the defaultCmdlineOptions
.
:: TestableHTF t | |
=> [String] | Commandline arguments |
-> t | Testable thing |
-> IO ExitCode | See |
Run something testable, parse the CmdlineOptions
from the given commandline arguments.
Does not print the overall test results but returns an IO
action for doing so.
:: TestableHTF t | |
=> [String] | Commandline arguments |
-> t | Testable thing |
-> IO (IO (), ExitCode) |
|
Run something testable, parse the CmdlineOptions
from the given commandline arguments.
runTestWithOptions :: TestableHTF t => CmdlineOptions -> t -> IO ExitCodeSource
Runs something testable with the given CmdlineOptions
.
See runTestWithConfig
for a specification of the ExitCode
result.
runTestWithOptions' :: TestableHTF t => CmdlineOptions -> t -> IO (IO (), ExitCode)Source
Runs something testable with the given CmdlineOptions
. Does not
print the overall test results but returns an IO
action for doing so.
See runTestWithConfig
for a specification of the ExitCode
result.
runTestWithConfig :: TestableHTF t => TestConfig -> t -> IO ExitCodeSource
Runs something testable with the given TestConfig
.
The result is ExitSuccess
if all tests were executed successfully,
ExitFailure
otherwise. In the latter case, an error code of 1
indicates
that failures but no errors occurred, otherwise the error code 2
is used.
A test is successful if the test terminates and no assertion fails. A test is said to fail if an assertion fails but no other error occur.
runTestWithConfig' :: TestableHTF t => TestConfig -> t -> IO (IO (), ExitCode)Source
Runs something testable with the given TestConfig
. Does not
print the overall test results but returns an IO
action for doing so.
See runTestWithConfig
for a specification of the ExitCode
result.
Organzing tests
class TestableHTF t Source
A type class for things that can be run as tests. Mainly used internally.
TestableHTF TestSuite | |
TestableHTF Test | |
TestableHTF t => TestableHTF [t] | |
TestableHTF (IO a) |
makeQuickCheckTest :: TestID -> Location -> Assertion -> TestSource
Construct a test where the given Assertion
checks a quick check property.
Mainly used internally by the htfpp preprocessor.
makeUnitTest :: AssertionWithTestOptions a => TestID -> Location -> a -> TestSource
Construct a unit test from the given IO
action.
Mainly used internally by the htfpp preprocessor.
makeBlackBoxTest :: TestID -> Assertion -> TestSource
Construct a black box test from the given Assertion
.
Mainly used internally.
makeTestSuite :: TestID -> [Test] -> TestSuiteSource
makeAnonTestSuite :: [Test] -> TestSuiteSource
addToTestSuite :: TestSuite -> [Test] -> TestSuiteSource