Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains MockT and SetupMockT state functions.
Synopsis
- data MockState m = MockState {
- mockExpectSet :: TVar (ExpectSet (Step m))
- mockDefaults :: TVar [(Bool, Step m)]
- mockCheckAmbiguity :: TVar Bool
- mockClasses :: TVar (Set TypeRep)
- mockParent :: Maybe (MockState m)
- initMockState :: MonadIO m => Maybe (MockState m) -> m (MockState m)
- allStates :: MockState m -> [MockState m]
- rootState :: MockState m -> MockState m
- newtype MockSetup m a where
- runInRootState :: MockSetup m a -> MockSetup m a
- mockSetupSTM :: STM a -> MockSetup m a
- initClassIfNeeded :: forall cls m proxy. (Mockable cls, Typeable m, MonadIO m) => proxy cls -> MockSetup m ()
- initClassesAsNeeded :: MonadIO m => ExpectSet (Step m) -> MockSetup m ()
- newtype MockT m a where
- mapMockT :: (m a -> m b) -> MockT m a -> MockT m b
- class MockContext ctx where
- fromMockSetup :: MonadIO m => MockSetup m a -> ctx m a
- expectThisSet :: MonadIO m => ExpectSet (Step m) -> MockT m ()
Documentation
Full state of a mock.
MockState | |
|
allStates :: MockState m -> [MockState m] Source #
Gets a list of all states, starting with the innermost.
newtype MockSetup m a where Source #
Monad for setting up a mockable class. Note that even though the type looks that way, this is *not* a monad transformer. It's a very restricted environment that can only be used to set up defaults for a class.
Instances
MockContext MockSetup Source # | |
Defined in Test.HMock.Internal.State | |
Monad (MockSetup m) Source # | |
Functor (MockSetup m) Source # | |
Applicative (MockSetup m) Source # | |
Defined in Test.HMock.Internal.State |
runInRootState :: MockSetup m a -> MockSetup m a Source #
Runs a setup action with the root state, rather than the current one.
initClassIfNeeded :: forall cls m proxy. (Mockable cls, Typeable m, MonadIO m) => proxy cls -> MockSetup m () Source #
Runs class initialization for a Mockable
class, if it hasn't been run
yet.
newtype MockT m a where Source #
Monad transformer for running mocks.
Instances
mapMockT :: (m a -> m b) -> MockT m a -> MockT m b Source #
Applies a function to the base monad of MockT
.
class MockContext ctx where Source #
fromMockSetup :: MonadIO m => MockSetup m a -> ctx m a Source #
Runs a MockSetup
action in this monad.
Instances
MockContext MockSetup Source # | |
Defined in Test.HMock.Internal.State | |
MockContext MockT Source # | |
Defined in Test.HMock.Internal.State |