Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hledger.Utils.Test
Synopsis
- type HasCallStack = ?callStack :: CallStack
- bool :: Test Bool
- double :: Test Double
- double' :: Double -> Double -> Test Double
- int :: Test Int
- int' :: Int -> Int -> Test Int
- listOf :: Int -> Test a -> Test [a]
- listsOf :: [Int] -> Test a -> Test [[a]]
- mapOf :: Ord k => Int -> Test k -> Test v -> Test (Map k v)
- mapsOf :: Ord k => [Int] -> Test k -> Test v -> Test [Map k v]
- pair :: Test a -> Test b -> Test (a, b)
- pick :: [a] -> Test a
- random :: Random a => Test a
- random' :: Random a => a -> a -> Test a
- word :: Test Word
- word' :: Word -> Word -> Test Word
- word8 :: Test Word8
- word8' :: Word8 -> Word8 -> Test Word8
- crash :: HasCallStack => Text -> Test a
- note :: Text -> Test ()
- scope :: Text -> Test a -> Test a
- expect :: HasCallStack -> Bool -> Test ()
- expectEq :: (Eq a, Show a, HasCallStack) => a -> a -> Test ()
- expectJust :: HasCallStack => Maybe a -> Test ()
- expectLeft :: (Show a, HasCallStack) => Either e a -> Test ()
- expectLeftNoShow :: HasCallStack => Either e a -> Test ()
- expectRight :: (Show e, HasCallStack) => Either e a -> Test ()
- expectRightNoShow :: HasCallStack => Either e a -> Test ()
- fork :: Test a -> Test ()
- fork' :: Test a -> Test (Test a)
- io :: IO a -> Test a
- note' :: Show s => s -> Test ()
- ok :: Test ()
- rerun :: Int -> Test a -> IO ()
- rerunOnly :: Int -> Text -> Test a -> IO ()
- run :: Test a -> IO ()
- runOnly :: Text -> Test a -> IO ()
- skip :: Test ()
- using :: IO r -> (r -> IO ()) -> (r -> Test a) -> Test a
- data Test a
- runEasytests :: [String] -> Test () -> IO Bool
- tests :: Text -> [Test ()] -> Test ()
- _tests :: Text -> [Test ()] -> Test ()
- test :: Text -> Test a -> Test a
- _test :: Text -> Test a -> Test a
- it :: Text -> Test a -> Test a
- _it :: Text -> Test a -> Test a
- is :: (Eq a, Show a, HasCallStack) => a -> a -> Test ()
- expectEqPP :: (Eq a, Show a, HasCallStack) => a -> a -> Test ()
- expectParse :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text IO) a -> Text -> Test ()
- expectParseE :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> Test ()
- expectParseError :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text IO) a -> Text -> String -> Test ()
- expectParseErrorE :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> String -> Test ()
- expectParseEq :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text IO) a -> Text -> a -> Test ()
- expectParseEqE :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> a -> Test ()
- expectParseEqOn :: (Monoid st, Eq b, Show b, HasCallStack) => StateT st (ParsecT CustomErr Text IO) a -> Text -> (a -> b) -> b -> Test ()
- expectParseEqOnE :: (Monoid st, Eq b, Show b, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> (a -> b) -> b -> Test ()
Documentation
type HasCallStack = ?callStack :: CallStack Source #
Request a CallStack.
NOTE: The implicit parameter ?callStack :: CallStack
is an
implementation detail and should not be considered part of the
CallStack
API, we may decide to change the implementation in the
future.
Since: base-4.9.0.0
crash :: HasCallStack => Text -> Test a #
expect :: HasCallStack -> Bool -> Test () #
expectJust :: HasCallStack => Maybe a -> Test () #
expectLeft :: (Show a, HasCallStack) => Either e a -> Test () #
expectLeftNoShow :: HasCallStack => Either e a -> Test () #
expectRight :: (Show e, HasCallStack) => Either e a -> Test () #
expectRightNoShow :: HasCallStack => Either e a -> Test () #
Instances
Monad Test | |
Functor Test | |
Applicative Test | |
MonadIO Test | |
Alternative Test | |
MonadPlus Test | |
MonadReader Env Test | |
IsString (Test a -> Test a) | |
Defined in EasyTest.Internal |
runEasytests :: [String] -> Test () -> IO Bool Source #
Run some easytest tests, catching easytest's ExitCode exception, returning True if there was a problem. With arguments, runs only the scope (or single test) named by the first argument (exact, case sensitive). If there is a second argument, it should be an integer and will be used as the seed for randomness.
tests :: Text -> [Test ()] -> Test () Source #
Name and group a list of tests. Combines easytest's "scope" and "tests".
_tests :: Text -> [Test ()] -> Test () Source #
Skip the given list of tests, and any following tests in a monadic sequence, with the same type signature as "group".
test :: Text -> Test a -> Test a Source #
Name the given test(s). A readability synonym for easytest's "scope".
_test :: Text -> Test a -> Test a Source #
Skip the given test(s), with the same type signature as "test". If called in a monadic sequence of tests, also skips following tests.
_it :: Text -> Test a -> Test a Source #
Skip the given test(s), and any following tests in a monadic sequence. A synonym for "_test".
is :: (Eq a, Show a, HasCallStack) => a -> a -> Test () Source #
Shorter and flipped version of expectEqPP. The expected value goes last.
expectEqPP :: (Eq a, Show a, HasCallStack) => a -> a -> Test () Source #
Like easytest's expectEq (asserts the second (actual) value equals the first (expected) value) but pretty-prints the values in the failure output.
expectParse :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text IO) a -> Text -> Test () Source #
Test that this stateful parser runnable in IO successfully parses all of the given input text, showing the parse error if it fails.
expectParseE :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> Test () Source #
expectParseError :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text IO) a -> Text -> String -> Test () Source #
Test that this stateful parser runnable in IO fails to parse the given input text, with a parse error containing the given string.
expectParseErrorE :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> String -> Test () Source #
expectParseEq :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text IO) a -> Text -> a -> Test () Source #
Like expectParse, but also test the parse result is an expected value, pretty-printing both if it fails.
expectParseEqE :: (Monoid st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> a -> Test () Source #