hledger-lib-1.52: A library providing the core functionality of hledger
Safe HaskellNone
LanguageGHC2021

Hledger.Utils.Test

Synopsis

Documentation

askOption :: IsOption v => (v -> TestTree) -> TestTree #

localOption :: IsOption v => v -> TestTree -> TestTree #

defaultIngredients :: [Ingredient] #

data 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 #

Methods

assert :: t -> Assertion #

Instances

Instances details
Assertable String 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

assert :: String -> Assertion #

Assertable () 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

assert :: () -> Assertion #

Assertable Bool 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

assert :: Bool -> Assertion #

Assertable t => Assertable (IO t) 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

assert :: IO t -> Assertion #

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

class AssertionPredicable t where #

Methods

assertionPredicate :: t -> IO Bool #

Instances

Instances details
AssertionPredicable Bool 
Instance details

Defined in Test.Tasty.HUnit.Orig

AssertionPredicable t => AssertionPredicable (IO t) 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

assertionPredicate :: IO t -> IO Bool #

type Assertion = IO () #

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 #

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.

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.