| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.BDD.LanguageFree
Description
Free monads for composing GivenWhenThen scenarios.
Module : Test.BDD.LanguageFree Copyright : (c) Paolo Veronelli 2017 License : BSD-3-Clause Maintainer: paolo.veronelli@gmail.com Stability : experimental Portability: non-portable
Synopsis
- given :: m a -> Free (GivenFree m) a
- givenAndAfter_ :: Functor m => m r -> (r -> m ()) -> Free (GivenFree m) ()
- givenAndAfter :: m (b, r) -> (r -> m ()) -> Free (GivenFree m) b
- then_ :: (t -> m ()) -> Free (ThenFree m t) ()
- then__ :: m () -> Free (ThenFree m t) ()
- when_ :: m t -> Free (ThenFree m t) b -> Free (GivenFree m) ()
- data GivenFree (m :: Type -> Type) a
- data ThenFree (m :: Type -> Type) t a
- type FreeBDD (m :: Type -> Type) x = Free (GivenFree m) x
- testFreeBDD :: MonadCatch m => Free (GivenFree m) x -> m (BDDResult m)
- data BDDResult (m :: Type -> Type)
- = Failed SomeException (m ())
- | Succeded (m ())
Documentation
given :: m a -> Free (GivenFree m) a Source #
Run a preparation action and return its value to subsequent steps.
givenAndAfter_ :: Functor m => m r -> (r -> m ()) -> Free (GivenFree m) () Source #
Acquire a resource and record its teardown without returning a value.
givenAndAfter :: m (b, r) -> (r -> m ()) -> Free (GivenFree m) b Source #
Acquire a value and resource, recording the resource teardown.
then_ :: (t -> m ()) -> Free (ThenFree m t) () Source #
Add an assertion using the scenario action result.
then__ :: m () -> Free (ThenFree m t) () Source #
Add an assertion independent of the scenario action result.
when_ :: m t -> Free (ThenFree m t) b -> Free (GivenFree m) () Source #
Run the scenario action and feed its result to the assertions.
data ThenFree (m :: Type -> Type) t a Source #
Assertions that consume the result of a scenario action.
type FreeBDD (m :: Type -> Type) x = Free (GivenFree m) x Source #
A scenario built from preparation instructions.
testFreeBDD :: MonadCatch m => Free (GivenFree m) x -> m (BDDResult m) Source #
Execute a scenario and return its result with recorded teardown.