License | BSD-3 |
---|---|
Maintainer | autotaker@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
DSL to generate mock methods.
Synopsis
- type Mock method = MockM method ()
- data MockM method a
- mockup :: Method method => Mock method -> method
- thenReturn :: (Behave x, Method (MethodOf x)) => Condition x -> Ret (MethodOf x) -> x
- thenAction :: (Behave x, Method (MethodOf x)) => Condition x -> Base (MethodOf x) (Ret (MethodOf x)) -> x
- thenMethod :: Behave x => Condition x -> MethodOf x -> x
- throwNoStubWithShow :: Method method => (Args method -> String) -> (Args method -> Bool) -> Mock method
- throwNoStub :: (Method method, Show (AsTuple (Args method)), TupleLike (Args method)) => Matcher (Args method) -> Mock method
Documentation
Instances
Monad (MockM method) Source # | |
Functor (MockM method) Source # | |
Applicative (MockM method) Source # | |
Defined in Test.Method.Mock | |
a ~ () => Behave (MockM method a) Source # | |
type Condition (MockM method a) Source # | |
Defined in Test.Method.Mock | |
type MethodOf (MockM method a) Source # | |
Defined in Test.Method.Mock |
mockup :: Method method => Mock method -> method Source #
generate a method from Mock DSL. Mock DSL consists of rules. On a call of generated method, the first rule matched the arguments is applied.
thenReturn :: (Behave x, Method (MethodOf x)) => Condition x -> Ret (MethodOf x) -> x Source #
Specify behavior that return a constant value for a call
thenAction :: (Behave x, Method (MethodOf x)) => Condition x -> Base (MethodOf x) (Ret (MethodOf x)) -> x Source #
Specify behavior that executes an action for a call
thenMethod :: Behave x => Condition x -> MethodOf x -> x Source #
Specify behavior from a pair of a condition and a method.