Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hledger.Utils.Test
Synopsis
- adjustOption :: IsOption v => (v -> v) -> TestTree -> TestTree
- askOption :: IsOption v => (v -> TestTree) -> TestTree
- defaultIngredients :: [Ingredient]
- localOption :: IsOption v => v -> TestTree -> TestTree
- withResource :: IO a -> (a -> IO ()) -> (IO a -> TestTree) -> TestTree
- defaultMainWithIngredients :: [Ingredient] -> TestTree -> IO ()
- after :: DependencyType -> String -> TestTree -> TestTree
- after_ :: DependencyType -> Expr -> TestTree -> TestTree
- testGroup :: TestName -> [TestTree] -> TestTree
- includingOptions :: [OptionDescription] -> Ingredient
- mkTimeout :: Integer -> Timeout
- data DependencyType
- type TestName = String
- data TestTree
- data Timeout
- tests :: String -> [TestTree] -> TestTree
- test :: String -> Assertion -> TestTree
- assertLeft :: (HasCallStack, Eq b, Show b) => Either a b -> Assertion
- assertRight :: (HasCallStack, Eq a, Show a) => Either a b -> Assertion
- assertParse :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr Text IO) a -> Text -> Assertion
- assertParseEq :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr Text IO) a -> Text -> a -> Assertion
- assertParseEqOn :: (HasCallStack, Eq b, Show b, Default st) => StateT st (ParsecT CustomErr Text IO) a -> Text -> (a -> b) -> b -> Assertion
- assertParseError :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr Text IO) a -> String -> String -> Assertion
- assertParseE :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> Assertion
- assertParseEqE :: (Default st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> a -> Assertion
- assertParseErrorE :: (Default st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> String -> Assertion
- assertParseStateOn :: (HasCallStack, Eq b, Show b, Default st) => StateT st (ParsecT CustomErr Text IO) a -> Text -> (st -> b) -> b -> Assertion
Documentation
adjustOption :: IsOption v => (v -> v) -> TestTree -> TestTree #
defaultIngredients :: [Ingredient] #
localOption :: IsOption v => v -> TestTree -> TestTree #
withResource :: IO a -> (a -> IO ()) -> (IO a -> TestTree) -> TestTree #
defaultMainWithIngredients :: [Ingredient] -> TestTree -> IO () #
after :: DependencyType -> String -> TestTree -> TestTree #
after_ :: DependencyType -> Expr -> TestTree -> TestTree #
includingOptions :: [OptionDescription] -> Ingredient #
data DependencyType #
Constructors
AllSucceed | |
AllFinish |
Instances
Eq DependencyType | |
Defined in Test.Tasty.Core Methods (==) :: DependencyType -> DependencyType -> Bool (/=) :: DependencyType -> DependencyType -> Bool | |
Show DependencyType | |
Defined in Test.Tasty.Core Methods showsPrec :: Int -> DependencyType -> ShowS show :: DependencyType -> String showList :: [DependencyType] -> ShowS |
Instances
Show Timeout | |
IsOption Timeout | |
Defined in Test.Tasty.Options.Core Methods parseValue :: String -> Maybe Timeout optionName :: Tagged Timeout String optionHelp :: Tagged Timeout String optionCLParser :: Parser Timeout |
tests :: String -> [TestTree] -> TestTree Source #
Name and group a list of tests. Shorter alias for Test.Tasty.HUnit.testGroup.
test :: String -> Assertion -> TestTree Source #
Name an assertion or sequence of assertions. Shorter alias for Test.Tasty.HUnit.testCase.
assertLeft :: (HasCallStack, Eq b, Show b) => Either a b -> Assertion Source #
Assert any Left value.
assertRight :: (HasCallStack, Eq a, Show a) => Either a b -> Assertion Source #
Assert any Right value.
assertParse :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr Text IO) a -> Text -> Assertion Source #
Assert that this stateful parser runnable in IO successfully parses all of the given input text, showing the parse error if it fails. Suitable for hledger's JournalParser parsers.
assertParseEq :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr Text IO) a -> Text -> a -> Assertion Source #
Assert a parser produces an expected value.
assertParseEqOn :: (HasCallStack, Eq b, Show b, Default st) => StateT st (ParsecT CustomErr Text IO) a -> Text -> (a -> b) -> b -> Assertion Source #
Like assertParseEq, but transform the parse result with the given function before comparing it.
assertParseError :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr Text IO) a -> String -> String -> Assertion Source #
Assert that this stateful parser runnable in IO fails to parse the given input text, with a parse error containing the given string.
assertParseE :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> Assertion Source #
These E variants of the above are suitable for hledger's ErroringJournalParser parsers.
assertParseEqE :: (Default st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> a -> Assertion Source #
assertParseErrorE :: (Default st, Eq a, Show a, HasCallStack) => StateT st (ParsecT CustomErr Text (ExceptT FinalParseError IO)) a -> Text -> String -> Assertion Source #
assertParseStateOn :: (HasCallStack, Eq b, Show b, Default st) => StateT st (ParsecT CustomErr Text IO) a -> Text -> (st -> b) -> b -> Assertion Source #
Run a stateful parser in IO like assertParse, then assert that the final state (the wrapped state, not megaparsec's internal state), transformed by the given function, matches the given expected value.