Modulehspec-expectations-0.8.4Haskell2010
Test.Hspec.Expectations
Introductory documentation: https://github.com/hspec/hspec-expectations#readme
- 3 types
- 18 values
- Packagehspec-expectations-0.8.4
- Exports21
- LanguageHaskell2010
- LicenceMIT
- SourceExpectations.hs
Setting expectations
13 declarationsactual `shouldBe` expected sets the expectation that actual is equal
to expected.
v `shouldSatisfy` p sets the expectation that p v is True.
list `shouldStartWith` prefix sets the expectation that list starts with prefix,
list `shouldEndWith` suffix sets the expectation that list ends with suffix,
list `shouldContain` sublist sets the expectation that sublist is contained,
wholly and intact, anywhere in list.
xs `shouldMatchList` ys sets the expectation that xs has the same
elements that ys has, possibly in another order
action `shouldReturn` expected sets the expectation that action
returns expected.
actual `shouldNotBe` notExpected sets the expectation that actual is not
equal to notExpected
v `shouldNotSatisfy` p sets the expectation that p v is False.
list `shouldNotContain` sublist sets the expectation that sublist is not
contained anywhere in list.
action `shouldNotReturn` notExpected sets the expectation that action
does not return notExpected.
Expecting exceptions
1 declarationaction `shouldThrow` selector sets the expectation that action throws
an exception. The precise nature of the expected exception is described
with a Selector.
Selecting exceptions
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
is just const True with an appropriate type.
Combinators for defining value-based selectors
Some exceptions (most prominently ErrorCall) have no Eq instance. Selecting a specific value would require pattern matching.
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).
Re-exports
1 declarationRequest 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.