tasty-bdd-0.1.0.0: BDD tests language and tasty provider

Copyright(c) Paolo Veronelli Pavlo Kerestey 2017
LicenseBSD3
Maintainerpaolo.veronelli@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Test.BDD.Language

Description

The constrained language to define behaviors in BDD terminology

exampleL :: TestTree
exampleL = testBehavior "Test sequence"
    $ Given (print "Some effect")
    $ Given (print "Another effect")
    $ GivenAndAfter (print "Aquiring resource" >> return "Resource 1")
                   (print . ("Release "++))
    $ GivenAndAfter (print "Aquiring resource" >> return "Resource 2")
                   (print . ("Release "++))
    $ When (print "Action returning" >> return ([1..10]++[100..106]) :: IO [Int])
    $ Then (@?= ([1..10]++[700..706]))
    $ End
Synopsis

Documentation

data Language m t q a where Source #

Bare hoare language

Constructors

Given :: m () -> Language m t q Preparing -> Language m t q Preparing

action to prepare the test

GivenAndAfter :: m r -> (r -> m ()) -> Language m t q Preparing -> Language m t q Preparing

action to prepare the test, and related teardown action

When :: m t -> Language m t q Testing -> Language m t q Preparing

core logic of the test (last preparing action)

Then :: (t -> m q) -> Language m t q Testing -> Language m t q Testing

action producing a test

End :: Language m t q Testing

final placeholder

type BDDPreparing m t q = Language m t q Preparing Source #

Preparing language types

type BDDTesting m t q = Language m t q Testing Source #

Testing language types

data BDDTest m t q Source #

Result of this module interpreter

Constructors

BDDTest 

Fields

Instances
(Typeable t, TestableMonad m) => IsTest (BDDTest m t ()) Source #

any testable monad can make a BDDTest a tasty test

Instance details

Defined in Test.Tasty.Bdd

Methods

run :: OptionSet -> BDDTest m t () -> (Progress -> IO ()) -> IO Result #

testOptions :: Tagged (BDDTest m t ()) [OptionDescription] #

data TestContext m Source #

Recording given actions and type related teardowns

Constructors

TestContext (m r) (r -> m ()) 

context :: forall m t q. Lens' (BDDTest m t q) [TestContext m] Source #

when :: forall m t q. Lens' (BDDTest m t q) (m t) Source #

tests :: forall m t q q. Lens (BDDTest m t q) (BDDTest m t q) [t -> m q] [t -> m q] Source #

interpret :: Monad m => Language m t q a -> BDDTest m t q Source #

An interpreter collecting the actions

data Phase Source #

Separating the 2 phases by type

Constructors

Preparing 
Testing