| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Hledger.Utils.Test
Synopsis
- data Timeout
- after :: DependencyType -> String -> TestTree -> TestTree
- askOption :: IsOption v => (v -> TestTree) -> TestTree
- localOption :: IsOption v => v -> TestTree -> TestTree
- defaultIngredients :: [Ingredient]
- mkTimeout :: Integer -> Timeout
- data TestTree
- data DependencyType
- type TestName = String
- testGroup :: TestName -> [TestTree] -> TestTree
- sequentialTestGroup :: TestName -> DependencyType -> [TestTree] -> TestTree
- after_ :: DependencyType -> Expr -> TestTree -> TestTree
- includingOptions :: [OptionDescription] -> Ingredient
- defaultMainWithIngredients :: [Ingredient] -> TestTree -> IO ()
- adjustOption :: IsOption v => (v -> v) -> TestTree -> TestTree
- withResource :: IO a -> (a -> IO ()) -> (IO a -> TestTree) -> TestTree
- class Assertable t where
- type HasCallStack = ?callStack :: CallStack
- type AssertionPredicate = IO Bool
- data HUnitFailure = HUnitFailure (Maybe SrcLoc) String
- class AssertionPredicable t where
- assertionPredicate :: t -> IO Bool
- type Assertion = IO ()
- assertFailure :: HasCallStack => String -> IO a
- assertBool :: HasCallStack => String -> Bool -> Assertion
- assertEqual :: (Eq a, Show a, HasCallStack) => String -> a -> a -> Assertion
- (@=?) :: (Eq a, Show a, HasCallStack) => a -> a -> Assertion
- (@?=) :: (Eq a, Show a, HasCallStack) => a -> a -> Assertion
- (@?) :: (AssertionPredicable t, HasCallStack) => t -> String -> Assertion
- assertString :: HasCallStack => String -> Assertion
- testCaseSteps :: TestName -> ((String -> IO ()) -> Assertion) -> TestTree
- testCase :: TestName -> Assertion -> TestTree
- testCaseInfo :: TestName -> IO String -> TestTree
- assertLeft :: (HasCallStack, Eq b, Show b) => Either a b -> Assertion
- assertRight :: (HasCallStack, Eq a, Show a) => Either a b -> Assertion
- assertParse :: (HasCallStack, Default st) => StateT st (ParsecT HledgerParseErrorData Text IO) a -> Text -> Assertion
- assertParseEq :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT HledgerParseErrorData Text IO) a -> Text -> a -> Assertion
- assertParseEqOn :: (HasCallStack, Eq b, Show b, Default st) => StateT st (ParsecT HledgerParseErrorData Text IO) a -> Text -> (a -> b) -> b -> Assertion
- assertParseError :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT HledgerParseErrorData Text IO) a -> Text -> String -> Assertion
- assertParseE :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT HledgerParseErrorData Text (ExceptT FinalParseError IO)) a -> Text -> Assertion
- assertParseEqE :: (Default st, Eq a, Show a, HasCallStack) => StateT st (ParsecT HledgerParseErrorData Text (ExceptT FinalParseError IO)) a -> Text -> a -> Assertion
- assertParseErrorE :: (Default st, Eq a, Show a, HasCallStack) => StateT st (ParsecT HledgerParseErrorData Text (ExceptT FinalParseError IO)) a -> Text -> String -> Assertion
- assertParseStateOn :: (HasCallStack, Eq b, Show b, Default st) => StateT st (ParsecT HledgerParseErrorData Text IO) a -> Text -> (st -> b) -> b -> Assertion
Documentation
Instances
| Show Timeout | |
| Eq Timeout | |
| Ord Timeout | |
Defined in Test.Tasty.Options.Core | |
| IsOption Timeout | |
Defined in Test.Tasty.Options.Core Methods parseValue :: String -> Maybe Timeout optionName :: Tagged Timeout String optionHelp :: Tagged Timeout String showDefaultValue :: Timeout -> Maybe String optionCLParser :: Parser Timeout | |
localOption :: IsOption v => v -> TestTree -> TestTree #
defaultIngredients :: [Ingredient] #
data DependencyType #
Constructors
| AllSucceed | |
| AllFinish |
Instances
| Read DependencyType | |
Defined in Test.Tasty.Core | |
| Show DependencyType | |
Defined in Test.Tasty.Core | |
| Eq DependencyType | |
Defined in Test.Tasty.Core Methods (==) :: DependencyType -> DependencyType -> Bool Source # (/=) :: DependencyType -> DependencyType -> Bool Source # | |
sequentialTestGroup :: TestName -> DependencyType -> [TestTree] -> TestTree #
after_ :: DependencyType -> Expr -> TestTree -> TestTree #
includingOptions :: [OptionDescription] -> Ingredient #
defaultMainWithIngredients :: [Ingredient] -> TestTree -> IO () #
adjustOption :: IsOption v => (v -> v) -> TestTree -> TestTree #
class Assertable t where #
Instances
| Assertable String | |
Defined in Test.Tasty.HUnit.Orig | |
| Assertable () | |
Defined in Test.Tasty.HUnit.Orig | |
| Assertable Bool | |
Defined in Test.Tasty.HUnit.Orig | |
| Assertable t => Assertable (IO t) | |
Defined in Test.Tasty.HUnit.Orig | |
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
type AssertionPredicate = IO Bool #
data HUnitFailure #
Constructors
| HUnitFailure (Maybe SrcLoc) String |
Instances
| Exception HUnitFailure | |
Defined in Test.Tasty.HUnit.Orig Methods toException :: HUnitFailure -> SomeException Source # fromException :: SomeException -> Maybe HUnitFailure Source # displayException :: HUnitFailure -> String Source # backtraceDesired :: HUnitFailure -> Bool Source # | |
| Show HUnitFailure | |
Defined in Test.Tasty.HUnit.Orig | |
| Eq HUnitFailure | |
Defined in Test.Tasty.HUnit.Orig Methods (==) :: HUnitFailure -> HUnitFailure -> Bool Source # (/=) :: HUnitFailure -> HUnitFailure -> Bool Source # | |
class AssertionPredicable t where #
Methods
assertionPredicate :: t -> IO Bool #
Instances
| AssertionPredicable Bool | |
Defined in Test.Tasty.HUnit.Orig Methods assertionPredicate :: Bool -> IO Bool # | |
| AssertionPredicable t => AssertionPredicable (IO t) | |
Defined in Test.Tasty.HUnit.Orig Methods assertionPredicate :: IO t -> IO Bool # | |
assertFailure :: HasCallStack => String -> IO a #
assertBool :: HasCallStack => String -> Bool -> Assertion #
assertEqual :: (Eq a, Show a, HasCallStack) => String -> a -> a -> Assertion #
(@?) :: (AssertionPredicable t, HasCallStack) => t -> String -> Assertion #
assertString :: HasCallStack => String -> Assertion #
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, Default st) => StateT st (ParsecT HledgerParseErrorData 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 HledgerParseErrorData 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 HledgerParseErrorData 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 HledgerParseErrorData Text IO) a -> Text -> 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 HledgerParseErrorData Text (ExceptT FinalParseError IO)) a -> Text -> Assertion Source #
assertParseEqE :: (Default st, Eq a, Show a, HasCallStack) => StateT st (ParsecT HledgerParseErrorData Text (ExceptT FinalParseError IO)) a -> Text -> a -> Assertion Source #
assertParseErrorE :: (Default st, Eq a, Show a, HasCallStack) => StateT st (ParsecT HledgerParseErrorData Text (ExceptT FinalParseError IO)) a -> Text -> String -> Assertion Source #
assertParseStateOn :: (HasCallStack, Eq b, Show b, Default st) => StateT st (ParsecT HledgerParseErrorData 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.