| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.HMock.TH
Description
This module provides Template Haskell splices that can be used to derive
boilerplate instances for HMock. makeMockable implements the common case
where you just want to generate everything you need to mock with a class.
The variant makeMockableWithOptions is similar, but takes an options
parameter that can be used to customize the generation.
Synopsis
- data MakeMockableOptions = MakeMockableOptions {}
- makeMockable :: Q Type -> Q [Dec]
- makeMockableWithOptions :: Q Type -> MakeMockableOptions -> Q [Dec]
Documentation
data MakeMockableOptions Source #
Custom options for deriving MockableBase and related instances.
Constructors
| MakeMockableOptions | |
Fields
| |
Instances
| Default MakeMockableOptions Source # | |
Defined in Test.HMock.TH Methods | |
makeMockable :: Q Type -> Q [Dec] Source #
Defines all instances necessary to use HMock with the given type, using
default options. The type should be a type class extending Monad, applied
to zero or more type arguments.
This defines all of the following instances, if necessary:
MockableBaseand the associatedActionandMatchertypes.Expectableinstances for theActiontype.Mockablewith an empty setup.- Instances of the provided application type class to allow unit tests to be
run with the
MockTmonad transformer.
makeMockableWithOptions :: Q Type -> MakeMockableOptions -> Q [Dec] Source #
Defines all instances necessary to use HMock with the given type, using
the provided options. The type should be a type class extending Monad,
applied to zero or more type arguments.
This defines the following instances, if necessary:
MockableBaseand the associatedActionandMatchertypes.Expectableinstances for theActiontype.- If
mockEmptySetupisTrue:Mockablewith an empty setup. - If
mockDeriveForMockTisTrue: Instances of the provided application type class to allow unit tests to be run with theMockTmonad transformer.