Introductory documentation: https://github.com/sol/test-shouldbe#readme
- shouldBe :: (Show a, Eq a) => a -> a -> Assertion
- shouldSatisfy :: Show a => a -> (a -> Bool) -> Assertion
- shouldReturn :: (Show a, Eq a) => IO a -> a -> Assertion
- shouldThrow :: Exception e => IO a -> Selector e -> Assertion
- type Selector a = a -> Bool
- anyException :: Selector SomeException
- anyErrorCall :: Selector ErrorCall
- anyIOException :: Selector IOException
- anyArithException :: Selector ArithException
- errorCall :: String -> Selector ErrorCall
actual `shouldBe` expected asserts that
actual is equal to
(this is just an alias for
v `shouldSatisfy` p asserts that
p v is
action `shouldReturn` expected asserts that
Checking for exceptions
action `shouldThrow` selector asserts that
action throws an exception.
The precise nature of that exception is described with a
Selector is a predicate; it can simultaneously constrain the type and
value of an exception.
Predefined type-based selectors
There are predefined selectors for some standard exceptions. Each selector
const True with an appropriate type.
Combinators for defining value-based selectors
For such exceptions, combinators that construct selectors are provided. Each combinator corresponds to a constructor; it takes the same arguments, and has the same name (but starting with a lower-case letter).