-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Modern and extensible testing framework -- -- See http://documentup.com/feuerbach/tasty @package tasty @version 0.2 -- | Extensible options. They are used for provider-specific settings, -- runner-specific settings and core settings (number of threads, test -- pattern). module Test.Tasty.Options -- | An option is a data type that inhabits the IsOption type class. class Typeable v => IsOption v where optionCLParser = nullOption (reader parse <> long name <> value defaultValue <> help helpString) where name = untag (optionName :: Tagged v String) helpString = untag (optionHelp :: Tagged v String) parse = maybe (Left (ErrorMsg $ "Could not parse " ++ name)) Right . parseValue defaultValue :: IsOption v => v parseValue :: IsOption v => String -> Maybe v optionName :: IsOption v => Tagged v String optionHelp :: IsOption v => Tagged v String optionCLParser :: IsOption v => Parser v -- | A set of options. Only one option of each type can be kept. -- -- If some option has not been explicitly set, the default value is used. data OptionSet -- | Set the option value setOption :: IsOption v => v -> OptionSet -> OptionSet -- | Change the option value changeOption :: IsOption v => (v -> v) -> OptionSet -> OptionSet -- | Query the option value lookupOption :: IsOption v => OptionSet -> v -- | The purpose of this data type is to capture the dictionary -- corresponding to a particular option. data OptionDescription Option :: Proxy v -> OptionDescription -- | Safe read function. Defined here for convenience to use for -- parseValue. safeRead :: Read a => String -> Maybe a instance [overlap ok] Monoid OptionSet -- | API for test providers module Test.Tasty.Providers -- | The interface to be implemented by a test provider. -- -- The type t is the concrete representation of the test which -- is used by the provider. class Typeable t => IsTest t run :: IsTest t => OptionSet -> t -> (Progress -> IO ()) -> IO Result testOptions :: IsTest t => Tagged t [OptionDescription] -- | A test result data Result Result :: Bool -> String -> Result -- | resultSuccessful should be True for a passed test and -- False for a failed one. resultSuccessful :: Result -> Bool -- | resultDescription may contain some details about the test. For -- a passed test it's ok to leave it empty. Providers like SmallCheck and -- QuickCheck use it to provide information about how many tests were -- generated. -- -- For a failed test, resultDescription should typically provide -- more information about the failure. resultDescription :: Result -> String -- | Test progress information. -- -- This may be used by a runner to provide some feedback to the user -- while a long-running test is executing. data Progress Progress :: String -> Float -> Progress -- | textual information about the test's progress progressText :: Progress -> String -- | progressPercent should be a value between 0 and 1. If it's -- impossible to compute the estimate, use 0. progressPercent :: Progress -> Float -- | The name of a test or a group of tests type TestName = String -- | The main data structure defining a test suite. -- -- It consists of individual test cases and properties, organized in -- named groups which form a tree-like hierarchy. -- -- There is no generic way to create a test case. Instead, every test -- provider (tasty-hunit, tasty-smallcheck etc.) provides a function to -- turn a test case into a TestTree. -- -- Groups can be created using testGroup. data TestTree -- | Convert a test to a leaf of the TestTree singleTest :: IsTest t => TestName -> t -> TestTree -- | API for test runners module Test.Tasty.Runners -- | The main data structure defining a test suite. -- -- It consists of individual test cases and properties, organized in -- named groups which form a tree-like hierarchy. -- -- There is no generic way to create a test case. Instead, every test -- provider (tasty-hunit, tasty-smallcheck etc.) provides a function to -- turn a test case into a TestTree. -- -- Groups can be created using testGroup. data TestTree -- | A single test of some particular type SingleTest :: TestName -> t -> TestTree -- | Assemble a number of tests into a cohesive group TestGroup :: TestName -> [TestTree] -> TestTree -- | Add some options to child tests PlusTestOptions :: (OptionSet -> OptionSet) -> TestTree -> TestTree -- | Fold a test tree into a single value. -- -- Apart from pure convenience, this function also does the following -- useful things: -- --