Copyright | (c) Pawel Nosal 2021 |
---|---|
License | MIT |
Maintainer | p.nosal1986@gmail.com |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions |
|
This mudule provide an assertion for check if expected Exception has been throw by IO action.
Synopsis
- assertThrowing :: (HasCallStack, Exception e) => IO a -> ExceptionSelector e -> Assertion' e b -> IO ()
- assertThrowing' :: (HasCallStack, Exception e) => IO a -> ExceptionSelector e -> IO ()
- anyException :: ExceptionSelector SomeException
- anyIOException :: ExceptionSelector IOException
- exceptionOfType :: Exception e => ExceptionSelector e
- type ExceptionSelector a = a -> a
Assertion util functions
assertThrowing :: (HasCallStack, Exception e) => IO a -> ExceptionSelector e -> Assertion' e b -> IO () Source #
assertThrowing' :: (HasCallStack, Exception e) => IO a -> ExceptionSelector e -> IO () Source #
Exception selectors
anyException :: ExceptionSelector SomeException Source #
Select all exceptions.
anyIOException :: ExceptionSelector IOException Source #
Select all IOException.
exceptionOfType :: Exception e => ExceptionSelector e Source #
Select all an Exception of given type.
This selector should be used with TypeApplications
data MyException = ThisException | ThatException deriving (Show) instance Exception MyException selectMyException = exceptionType @MyException
Exception selector type
type ExceptionSelector a = a -> a Source #