hledger-lib-1.40: A library providing the core functionality of hledger
Safe HaskellNone
LanguageHaskell2010

Hledger.Utils.Test

Synopsis

Documentation

defaultMainWithIngredients :: [Ingredient] -> TestTree -> IO () #

data DependencyType #

Constructors

AllSucceed 
AllFinish 

Instances

Instances details
Read DependencyType 
Instance details

Defined in Test.Tasty.Core

Methods

readsPrec :: Int -> ReadS DependencyType

readList :: ReadS [DependencyType]

readPrec :: ReadPrec DependencyType

readListPrec :: ReadPrec [DependencyType]

Show DependencyType 
Instance details

Defined in Test.Tasty.Core

Methods

showsPrec :: Int -> DependencyType -> ShowS

show :: DependencyType -> String

showList :: [DependencyType] -> ShowS

Eq DependencyType 
Instance details

Defined in Test.Tasty.Core

type TestName = String #

data TestTree #

includingOptions :: [OptionDescription] -> Ingredient #

data Timeout #

Constructors

Timeout Integer String 
NoTimeout 

Instances

Instances details
Show Timeout 
Instance details

Defined in Test.Tasty.Options.Core

Methods

showsPrec :: Int -> Timeout -> ShowS

show :: Timeout -> String

showList :: [Timeout] -> ShowS

IsOption Timeout 
Instance details

Defined in Test.Tasty.Options.Core

Methods

defaultValue :: Timeout

parseValue :: String -> Maybe Timeout

optionName :: Tagged Timeout String

optionHelp :: Tagged Timeout String

showDefaultValue :: Timeout -> Maybe String

optionCLParser :: Parser Timeout

mkTimeout :: Integer -> Timeout #

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 #

(@?=) :: (Eq a, Show a, HasCallStack) => a -> a -> Assertion #

assertBool :: HasCallStack => String -> Bool -> Assertion #

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 #

(@=?) :: (Eq a, Show a, HasCallStack) => a -> a -> Assertion #

(@?) :: (AssertionPredicable t, HasCallStack) => t -> String -> Assertion #

type Assertion = IO () #

class AssertionPredicable t where #

Methods

assertionPredicate :: t -> IO Bool #

Instances

Instances details
AssertionPredicable Bool 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

assertionPredicate :: Bool -> IO Bool #

AssertionPredicable t => AssertionPredicable (IO t) 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

assertionPredicate :: IO t -> IO Bool #

type AssertionPredicate = IO Bool #

data HUnitFailure #

Constructors

HUnitFailure (Maybe SrcLoc) String 

Instances

Instances details
Exception HUnitFailure 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

toException :: HUnitFailure -> SomeException

fromException :: SomeException -> Maybe HUnitFailure

displayException :: HUnitFailure -> String

Show HUnitFailure 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

showsPrec :: Int -> HUnitFailure -> ShowS

show :: HUnitFailure -> String

showList :: [HUnitFailure] -> ShowS

Eq HUnitFailure 
Instance details

Defined in Test.Tasty.HUnit.Orig

Methods

(==) :: HUnitFailure -> HUnitFailure -> Bool

(/=) :: HUnitFailure -> HUnitFailure -> Bool

assertEqual :: (Eq a, Show a, HasCallStack) => String -> a -> a -> Assertion #

assertFailure :: HasCallStack => String -> IO a #

testCaseSteps :: TestName -> ((String -> IO ()) -> Assertion) -> TestTree #

testCaseInfo :: TestName -> IO String -> TestTree #

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.