hspec-1.7.1: Behavior-Driven Development for Haskell

Safe HaskellNone

Test.Hspec.Monadic

Contents

Description

Deprecated: use Test.Hspec, Test.Hspec.Runner or Test.Hspec.Core instead

Synopsis

Types

type Spec = SpecM ()Source

class Example a Source

A type class for examples.

Instances

Example Bool 
Example Test

This instance is deprecated, use fromHUnitTest instead!

Example Property 
Example Expectation 
Example Result 

Defining a spec

describe :: String -> Spec -> SpecSource

Combine a list of specs into a larger spec.

context :: String -> Spec -> SpecSource

An alias for describe.

it :: Example a => String -> a -> SpecSource

Create a spec item.

A spec item consists of:

  • a textual description of a desired behavior
  • an example for that behavior
 describe "absolute" $ do
   it "returns a positive number when given a negative number" $
     absolute (-1) == 1

pending :: ExpectationSource

Specifies a pending example.

If you want to textually specify a behavior but do not have an example yet, use this:

 describe "fancyFormatter" $ do
   it "can format text in a way that everyone likes" $
     pending

Running a spec

hspec :: Spec -> IO ()Source

Run given spec and write a report to stdout. Exit with exitFailure if at least one spec item fails.

data Summary Source

Summary of a test run.

Constructors

Summary 

Interface to the non-monadic API

runSpecM :: Spec -> [SpecTree]Source

Convert a Spec to a forest of SpecTrees.

fromSpecList :: [SpecTree] -> SpecSource

Create a Spec from a forest of SpecTrees.

Deprecated types and functions