test-framework-0.4.2.0: Framework for running and organising tests, with HUnit and QuickCheck support

Test.Framework.Providers.API

Description

This module exports everything that you need to be able to create your own framework test provider. To create a provider you need to:

  • Create an instance of the Testlike class
  • Create an instance of the TestResultlike class
  • Expose a function that lets people construct Test values using your new instances

Synopsis

Documentation

class (Show i, Show r) => TestResultlike i r | r -> i whereSource

Something like the result of a test: works in concert with Testlike. The type parameters are the type that is used for progress reports and the type of the final output of the test respectively.

Methods

testSucceeded :: r -> BoolSource

class TestResultlike i r => Testlike i r t | t -> i r, r -> i whereSource

Something test-like in its behaviour. The type parameters are the type that is used for progress reports, the type of the final output of the test and the data type encapsulating the whole potential to do a test respectively.

Instances

type TestName = StringSource

Test names or descriptions. These are shown to the user

type TestTypeName = StringSource

The name of a type of test, such as Properties or Test Cases. Tests of types of the same names will be grouped together in the test run summary.

data Test Source

Main test data type: builds up a list of tests to be run. Users should use the utility functions in e.g. the test-framework-hunit and test-framework-quickcheck packages to create instances of Test, and then build them up into testsuites by using testGroup and lists.

For an example of how to use test-framework, please see http://github.com/batterseapower/test-framework/raw/master/example/Test/Framework/Example.lhs

Constructors

forall i r t . Testlike i r t => Test TestName t

A single test of some particular type

TestGroup TestName [Test]

Assemble a number of tests into a cohesive group

PlusTestOptions TestOptions Test

Add some options to child tests

BuildTest (IO Test)

Convenience for creating tests from an IO action

testGroup :: TestName -> [Test] -> TestSource

Assemble a number of tests into a cohesive group

plusTestOptions :: TestOptions -> Test -> TestSource

Add some options to child tests

buildTest :: IO Test -> TestSource

Convenience for creating tests from an IO action

data MutuallyExcluded t Source

Constructors

ME (MVar ()) t 

Instances

mutuallyExclusive :: Test -> TestSource

Mark all tests in this portion of the tree as mutually exclusive, so only one runs at a time

data i :~> f Source

Constructors

Finished f 
Improving i (i :~> f) 

Instances

Functor (:~> i) 

bimapImproving :: (a -> c) -> (b -> d) -> (a :~> b) -> c :~> dSource

improvingLast :: (a :~> b) -> bSource

consumeImproving :: (a :~> b) -> [a :~> b]Source

data ImprovingIO i f a Source

Instances

timeoutImprovingIO :: Int -> ImprovingIO i f a -> ImprovingIO i f (Maybe a)Source

Given a number of microseconds and an improving IO action, run that improving IO action only for at most the given period before giving up. See also timeout.

maybeTimeoutImprovingIO :: Maybe Int -> ImprovingIO i f a -> ImprovingIO i f (Maybe a)Source

As timeoutImprovingIO, but don't bother applying a timeout to the action if Nothing is given as the number of microseconds to apply the time out for.

newtype K a Source

Constructors

K 

Fields

unK :: a
 

mappendBy :: Monoid b => (a -> b) -> a -> a -> bSource

orElse :: Maybe a -> a -> aSource

onLeft :: (a -> c) -> (a, b) -> (c, b)Source

onRight :: (b -> c) -> (a, b) -> (a, c)Source

unlinesConcise :: [String] -> StringSource

Like unlines, but does not append a trailing newline if there is at least one line. For example:

 unlinesConcise ["A", "B"] == "A\nB"
 unlinesConcise [] == ""

Whereas:

 unlines ["A", "B"] == "A\nB\n"
 unlines [] == ""

This is closer to the behaviour of unwords, which does not append a trailing space.

mapAccumLM :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y])Source

dropLast :: Int -> [a] -> [a]Source