method-0.2.0.0: rebindable methods for improving testability
LicenseBSD-3
Maintainerautotaker@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Test.Method.Mock

Description

DSL to generate mock methods.

Synopsis

Documentation

type Mock method = Writer (MockSpec method) () Source #

data MockSpec method Source #

Instances

Instances details
Semigroup (MockSpec method) Source # 
Instance details

Defined in Test.Method.Mock

Methods

(<>) :: MockSpec method -> MockSpec method -> MockSpec method #

sconcat :: NonEmpty (MockSpec method) -> MockSpec method #

stimes :: Integral b => b -> MockSpec method -> MockSpec method #

Monoid (MockSpec method) Source # 
Instance details

Defined in Test.Method.Mock

Methods

mempty :: MockSpec method #

mappend :: MockSpec method -> MockSpec method -> MockSpec method #

mconcat :: [MockSpec method] -> MockSpec method #

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 :: (Method method, Applicative (Base method)) => Matcher (Args method) -> Ret method -> Mock method Source #

matcher `thenReturn` value means the method return value if the arguments matches matcher.

thenAction :: Method method => Matcher (Args method) -> Base method (Ret method) -> Mock method Source #

matcher `thenAction` action means the method executes action if the arguments matches matcher.

thenMethod :: Method method => Matcher (Args method) -> method -> Mock method Source #

matcher `thenMethod` action means the method call method with the arguments if the arguments matches matcher.

throwNoStubShow :: (Method method, Show (AsTuple (Args method)), TupleLike (Args method)) => Matcher (Args method) -> Mock method Source #

throwNoStubShow matcher means the method raises a runtime exception if the arguments matches matcher. The argument tuple is converted to String by using show function.

throwNoStub :: Method method => (Args method -> String) -> (Args method -> Bool) -> Mock method Source #

throwNoStubShow fshow matcher means the method raises runtime exception if the arguments matches matcher. The argument tuple is converted to String by using fshow function.