| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Testlib.Assertions
Synopsis
- assertBool :: HasCallStack => String -> Bool -> App ()
- assertOne :: (HasCallStack, Foldable t) => t a -> App a
- assertAtLeastOne :: (HasCallStack, Foldable t) => t a -> App ()
- expectFailure :: HasCallStack => (AssertionFailure -> App ()) -> App a -> App ()
- shouldMatch :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App ()
- eventually :: App a -> App a
- shouldMatchWithMsg :: (MakesValue a, MakesValue b, HasCallStack) => Maybe String -> a -> b -> App ()
- data LenientMatchRule
- shouldMatchWithRules :: (MakesValue a, MakesValue b, HasCallStack) => [LenientMatchRule] -> (Value -> App (Maybe Value)) -> a -> b -> App ()
- shouldMatchBase64 :: (MakesValue a, HasCallStack) => a -> ByteString -> App ()
- shouldNotMatch :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App ()
- shouldMatchInt :: (MakesValue a, HasCallStack) => a -> Int -> App ()
- shouldNotMatchInt :: (MakesValue a, HasCallStack) => a -> Int -> App ()
- shouldMatchRange :: (MakesValue a, HasCallStack) => a -> (Int, Int) -> App ()
- shouldMatchSet :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App ()
- shouldBeEmpty :: (MakesValue a, HasCallStack) => a -> App ()
- shouldBeNull :: (MakesValue a, HasCallStack) => a -> App ()
- shouldMatchOneOf :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App ()
- shouldContainString :: HasCallStack => String -> String -> App ()
- shouldContain :: (Eq a, Show a, HasCallStack) => [a] -> [a] -> App ()
- shouldNotContain :: (Eq a, Show a, HasCallStack) => [a] -> [a] -> App ()
- printFailureDetails :: AssertionFailure -> IO String
- printAppFailureDetails :: AppFailure -> IO String
- prettyContext :: String -> String
- printExceptionDetails :: SomeException -> IO String
- prettierCallStack :: CallStack -> IO String
- prettierCallStackLines :: CallStack -> IO String
- getSourceDir :: String -> IO (Maybe FilePath)
- type SourceDirCache = Map String (Maybe FilePath)
- getSourceDirCached :: SourceDirCache -> String -> IO (SourceDirCache, Maybe FilePath)
- tryReadFile :: FilePath -> IO (Maybe String)
- getLineNumber :: Int -> String -> Maybe String
- prettyResponse :: Response -> String
Documentation
assertBool :: HasCallStack => String -> Bool -> App () Source #
assertAtLeastOne :: (HasCallStack, Foldable t) => t a -> App () Source #
expectFailure :: HasCallStack => (AssertionFailure -> App ()) -> App a -> App () Source #
Arguments
| :: (MakesValue a, MakesValue b, HasCallStack) | |
| => a | The actual value |
| -> b | The expected value |
| -> App () |
eventually :: App a -> App a Source #
Retries every 100ms until timeOutSeconds from Env is reached
Arguments
| :: (MakesValue a, MakesValue b, HasCallStack) | |
| => Maybe String | Message to be added to failure report |
| -> a | The actual value |
| -> b | The expected value |
| -> App () |
data LenientMatchRule Source #
Constructors
| EmptyArrayIsNull | |
| ArraysAreSets | |
| RemoveNullFieldsFromObjects |
Instances
shouldMatchWithRules :: (MakesValue a, MakesValue b, HasCallStack) => [LenientMatchRule] -> (Value -> App (Maybe Value)) -> a -> b -> App () Source #
Arguments
| :: (MakesValue a, HasCallStack) | |
| => a | The actual value, in base64 |
| -> ByteString | The expected value |
| -> App () |
Arguments
| :: (MakesValue a, MakesValue b, HasCallStack) | |
| => a | The actual value |
| -> b | The un-expected value |
| -> App () |
Arguments
| :: (MakesValue a, HasCallStack) | |
| => a | The actual value |
| -> Int | The expected value |
| -> App () |
Specialized variant of shouldMatch to avoid the need for type annotations.
Arguments
| :: (MakesValue a, HasCallStack) | |
| => a | The actual value |
| -> Int | The expected value |
| -> App () |
Arguments
| :: (MakesValue a, HasCallStack) | |
| => a | The actual value |
| -> (Int, Int) | The expected range, inclusive both sides |
| -> App () |
shouldMatchSet :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App () Source #
Match on sorted lists (sets where elements may occur more than once). (Maybe this should
be called shouldMatchMultiSet?)
shouldBeEmpty :: (MakesValue a, HasCallStack) => a -> App () Source #
shouldBeNull :: (MakesValue a, HasCallStack) => a -> App () Source #
shouldMatchOneOf :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App () Source #
Arguments
| :: HasCallStack | |
| => String | The actual value |
| -> String | The expected value |
| -> App () |
Arguments
| :: (Eq a, Show a, HasCallStack) | |
| => [a] | The actual value |
| -> [a] | The expected value |
| -> App () |
Arguments
| :: (Eq a, Show a, HasCallStack) | |
| => [a] | The actual value |
| -> [a] | The expected value |
| -> App () |
prettyContext :: String -> String Source #
getSourceDirCached :: SourceDirCache -> String -> IO (SourceDirCache, Maybe FilePath) Source #
prettyResponse :: Response -> String Source #