-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Framework for running and organising tests, with HUnit and QuickCheck support -- -- Allows tests such as QuickCheck properties and HUnit test cases to be -- assembled into test groups, run in parallel (but reported in -- deterministic order, to aid diff interpretation) and filtered and -- controlled by command line options. All of this comes with colored -- test output, progress reporting and test statistics output. @package test-framework @version 0.8.1.1 module Test.Framework.Runners.TestPattern data TestPattern parseTestPattern :: String -> TestPattern testPatternMatches :: TestPattern -> [String] -> Bool instance Eq Token instance Read TestPattern module Test.Framework.Seed data Seed FixedSeed :: Int -> Seed RandomSeed :: Seed -- | Given a Seed, returns a new random number generator based on -- that seed and the actual numeric seed that was used to build that -- generator, so it can be recreated. newSeededStdGen :: Seed -> IO (StdGen, Int) newStdGenWithKnownSeed :: IO (StdGen, Int) instance Read Seed instance Show Seed module Test.Framework.Options type TestOptions = TestOptions' Maybe type CompleteTestOptions = TestOptions' K data TestOptions' f TestOptions :: f Seed -> f Int -> f Int -> f Int -> f Int -> f (Maybe Int) -> TestOptions' f -- | Seed that should be used to create random numbers for generated tests topt_seed :: TestOptions' f -> f Seed -- | Maximum number of tests to generate when using something like -- QuickCheck topt_maximum_generated_tests :: TestOptions' f -> f Int -- | Maximum number of unsuitable tests to consider before giving up when -- using something like QuickCheck topt_maximum_unsuitable_generated_tests :: TestOptions' f -> f Int -- | Maximum size of generated tests when using something like QuickCheck topt_maximum_test_size :: TestOptions' f -> f Int -- | Maximum depth of generated tests when using something like SmallCheck topt_maximum_test_depth :: TestOptions' f -> f Int -- | The number of microseconds to run tests for before considering them a -- failure topt_timeout :: TestOptions' f -> f (Maybe Int) instance Monoid (TestOptions' Maybe) module Test.Framework.Runners.Options data ColorMode ColorAuto :: ColorMode ColorNever :: ColorMode ColorAlways :: ColorMode type RunnerOptions = RunnerOptions' Maybe type CompleteRunnerOptions = RunnerOptions' K data RunnerOptions' f RunnerOptions :: f Int -> f TestOptions -> f [TestPattern] -> f (Maybe FilePath) -> f Bool -> f ColorMode -> f Bool -> f Bool -> RunnerOptions' f ropt_threads :: RunnerOptions' f -> f Int ropt_test_options :: RunnerOptions' f -> f TestOptions ropt_test_patterns :: RunnerOptions' f -> f [TestPattern] ropt_xml_output :: RunnerOptions' f -> f (Maybe FilePath) ropt_xml_nested :: RunnerOptions' f -> f Bool ropt_color_mode :: RunnerOptions' f -> f ColorMode ropt_hide_successes :: RunnerOptions' f -> f Bool ropt_list_only :: RunnerOptions' f -> f Bool data TestPattern instance Monoid (RunnerOptions' Maybe) -- | This module exports everything that you need to be able to create your -- own framework test provider. To create a provider you need to: -- --
-- 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. unlinesConcise :: [String] -> String mapAccumLM :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y]) padRight :: Int -> String -> String dropLast :: Int -> [a] -> [a] -- | This module exports everything that you need to be able to create your -- own test runner. module Test.Framework.Runners.API -- | TestRunner class simplifies folding a Test. You need to -- specify the important semantic actions by instantiating this class, -- and runTestTree will take care of recursion and test filtering. class TestRunner b runSimpleTest :: (TestRunner b, Testlike i r t, Typeable t) => TestOptions -> TestName -> t -> b skipTest :: TestRunner b => b runIOTest :: TestRunner b => IO (b, IO ()) -> b runGroup :: TestRunner b => TestName -> [b] -> b -- | Run the test tree using a TestRunner runTestTree :: TestRunner b => TestOptions -> [TestPattern] -> Test -> b module Test.Framework.Runners.Console defaultMain :: [Test] -> IO () -- | A version of defaultMain that lets you ignore the command line -- arguments in favour of another list of Strings. defaultMainWithArgs :: [Test] -> [String] -> IO () -- | A version of defaultMain that lets you ignore the command line -- arguments in favour of an explicit set of RunnerOptions. defaultMainWithOpts :: [Test] -> RunnerOptions -> IO () -- | Nothing signifies that usage information should be displayed. -- Just simply gives us the contribution to overall options by -- the command line option. type SuppliedRunnerOptions = Maybe RunnerOptions -- | Options understood by test-framework. This can be used to add more -- options to the tester executable. optionsDescription :: [OptDescr SuppliedRunnerOptions] -- | Parse the specified command line arguments into a RunnerOptions -- and some remaining arguments, or return a reason as to why we can't. interpretArgs :: [String] -> IO (Either String (RunnerOptions, [String])) -- | A version of interpretArgs that ends the process if it fails. interpretArgsOrExit :: [String] -> IO RunnerOptions -- | A generic test framework for all types of Haskell test. -- -- For an example of how to use test-framework, please see -- http://github.com/batterseapower/test-framework/raw/master/example/Test/Framework/Example.lhs module Test.Framework -- | 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. class (Show i, Show r) => TestResultlike i r | r -> i testSucceeded :: TestResultlike i r => r -> Bool -- | 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. class TestResultlike i r => Testlike i r t | t -> i r, r -> i runTest :: Testlike i r t => CompleteTestOptions -> t -> IO (i :~> r, IO ()) testTypeName :: Testlike i r t => t -> TestTypeName -- | Test names or descriptions. These are shown to the user type TestName = String -- | 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. type TestTypeName = String -- | 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 data Test -- | A single test of some particular type Test :: TestName -> t -> Test -- | Assemble a number of tests into a cohesive group TestGroup :: TestName -> [Test] -> Test -- | Add some options to child tests PlusTestOptions :: TestOptions -> Test -> Test -- | Convenience for creating tests from an IO action, with cleanup BuildTestBracketed :: (IO (Test, IO ())) -> Test -- | Assemble a number of tests into a cohesive group testGroup :: TestName -> [Test] -> Test -- | Add some options to child tests plusTestOptions :: TestOptions -> Test -> Test -- | Convenience for creating tests from an IO action buildTest :: IO Test -> Test -- | Convenience for creating tests from an IO action, with a -- cleanup handler for when tests are finished buildTestBracketed :: IO (Test, IO ()) -> Test data MutuallyExcluded t ME :: (MVar ()) -> t -> MutuallyExcluded t -- | Mark all tests in this portion of the tree as mutually exclusive, so -- only one runs at a time mutuallyExclusive :: Test -> Test