-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Quiet test runner -- -- Quiet test runner @package chell @version 0.1.3 module Test.Chell -- | A simple default main function, which runs a list of tests and logs -- statistics to stderr. defaultMain :: [Suite] -> IO () -- | A tree of Tests; use the test and suite helper -- functions to build up a Suite. data Suite suite :: Text -> [Suite] -> Suite suiteName :: Suite -> Text -- | The full list of Tests contained within this Suite. Each -- Test is returned with its name modified to include the name of -- its parent Suites. suiteTests :: Suite -> [Test] test :: Test -> Suite -- | Conditionally skip a test. Use this to avoid commenting out tests -- which are currently broken, or do not work on the current platform. -- --
-- tests = suite "tests" -- [ test (skipIf builtOnUnix test_WindowsSpecific) -- ] --skipIf :: Bool -> Test -> Test -- | Conditionally skip a test, depending on the result of a runtime check. -- --
-- tests = suite "tests" -- [ test (skipWhen noNetwork test_PingGoogle) -- ] --skipWhen :: IO Bool -> Test -> Test newtype Assertion Assertion :: (IO AssertionResult) -> Assertion data AssertionResult AssertionPassed :: AssertionResult AssertionFailed :: Text -> AssertionResult class IsAssertion a data Assertions a -- | Convert a sequence of pass/fail assertions into a runnable test. -- --
-- test_Equality :: Test -- test_Equality = assertions "equality" $ do -- $assert (1 == 1) -- $assert (equal 1 1) --assertions :: Text -> Assertions a -> Test -- | Run an Assertion. If the assertion fails, the test will -- immediately fail. -- -- assert is a Template Haskell macro, to retain the source-file -- location from which it was used. Its effective type is: -- --
-- $assert :: IsAssertion assertion => assertion -> Assertions () --assert :: Q Exp -- | Run an Assertion. If the assertion fails, the test will -- continue to run until it finishes (or until an assert fails). -- -- expect is a Template Haskell macro, to retain the source-file -- location from which it was used. Its effective type is: -- --
-- $expect :: IsAssertion assertion => assertion -> Assertions () --expect :: Q Exp -- | Cause a test to immediately fail, with a message. -- -- fail is a Template Haskell macro, to retain the source-file -- location from which it was used. Its effective type is: -- --
-- $fail :: Text -> Assertions a --fail :: Q Exp -- | Print a message from within a test. This is just a helper for -- debugging, so you don't have to import Debug.Trace. trace :: Text -> Assertions () -- | Attach metadata to a test run. This will be included in reports. note :: Text -> Text -> Assertions () -- | Assert that two values are equal. equal :: (Show a, Eq a) => a -> a -> Assertion -- | Assert that two values are not equal. notEqual :: (Eq a, Show a) => a -> a -> Assertion -- | Assert that two values are within some delta of each other. equalWithin :: (Real a, Show a) => a -> a -> a -> Assertion -- | Assert that some value is Just. just :: Maybe a -> Assertion -- | Assert that some value is Nothing. nothing :: Maybe a -> Assertion -- | Assert that some value is Left. left :: Either a b -> Assertion -- | Assert that some value is Right. right :: Either a b -> Assertion -- | Assert that some computation throws an exception matching the provided -- predicate. This is mostly useful for exception types which do not have -- an instance for Eq, such as ErrorCall. throws :: Exception err => (err -> Bool) -> IO a -> Assertion -- | Assert that some computation throws an exception equal to the given -- exception. This is better than just checking that the correct type was -- thrown, because the test can also verify the exception contains the -- correct information. throwsEq :: (Eq err, Exception err, Show err) => err -> IO a -> Assertion -- | Assert a value is greater than another. greater :: (Ord a, Show a) => a -> a -> Assertion -- | Assert a value is greater than or equal to another. greaterEqual :: (Ord a, Show a) => a -> a -> Assertion -- | Assert a value is less than another. lesser :: (Ord a, Show a) => a -> a -> Assertion -- | Assert a value is less than or equal to another. lesserEqual :: (Ord a, Show a) => a -> a -> Assertion -- | Assert that two containers have the same items, in any order. sameItems :: (Foldable container, Show item, Ord item) => container item -> container item -> Assertion -- | Assert that two containers have the same items, in the same order. equalItems :: (Foldable container, Show item, Ord item) => container item -> container item -> Assertion -- | Class for types which can be treated as text. class IsText a -- | Assert that two pieces of text are equal. This uses a diff algorithm -- to check line-by-line, so the error message will be easier to read on -- large inputs. equalLines :: (Ord a, IsText a) => a -> a -> Assertion data Test Test :: Text -> (TestOptions -> IO TestResult) -> Test -- |
-- testName (Test name _) = name --testName :: Test -> Text -- | Run a test, wrapped in error handlers. This will return -- TestAborted if the test throws an exception or times out. runTest :: Test -> TestOptions -> IO TestResult data TestOptions -- | Get the RNG seed for this test run. The seed is generated once, in -- defaultMain, and used for all tests. It is also logged to -- reports using a note. -- -- Users may specify a seed using the --seed command-line -- option. testOptionSeed :: TestOptions -> Int -- | An optional timeout, in millseconds. Tests which run longer than this -- timeout will be aborted. -- -- Users may specify a timeout using the --timeout command-line -- option. testOptionTimeout :: TestOptions -> Maybe Int data TestResult TestPassed :: [(Text, Text)] -> TestResult TestSkipped :: TestResult TestFailed :: [(Text, Text)] -> [Failure] -> TestResult TestAborted :: [(Text, Text)] -> Text -> TestResult data Failure Failure :: (Maybe Location) -> Text -> Failure data Location Location :: Text -> Text -> Integer -> Location locationFile :: Location -> Text locationModule :: Location -> Text locationLine :: Location -> Integer instance IsText ByteString instance IsText ByteString instance IsText Text instance IsText Text instance IsText String instance MonadIO Assertions instance Monad Assertions instance Applicative Assertions instance Functor Assertions instance IsAssertion Bool instance IsAssertion Assertion