hspec-0.9.1: Behavior Driven Development for Haskell

Test.Hspec.Core

Description

This module contains the core types, constructors, classes, instances, and utility functions common to hspec.

Synopsis

Documentation

data Result Source

The result of running an example.

Constructors

Success 
Pending String 
Fail String 

Instances

data Spec Source

Everything needed to specify and show a specific behavior.

Constructors

Spec 

Fields

name :: String

What is being tested, usually the name of a type.

requirement :: String

The specific behavior being tested.

result :: Result

The status of the example of this behavior.

depth :: Int

The level of nestedness.

UnevaluatedSpec 

Fields

name :: String

What is being tested, usually the name of a type.

requirement :: String

The specific behavior being tested.

example :: AnyExample

An example of this behavior.

depth :: Int

The level of nestedness.

descriptions :: [[Spec]] -> [Spec]Source

Combine a list of descriptions.

it :: Example a => String -> a -> [Spec]Source

Create a set of specifications for a specific type being described. Once you know what you want specs for, use this.

 describe "abs" [
   it "returns a positive number given a negative number"
     (abs (-1) == 1)
   ]

class Example a whereSource

Instances

Example Bool 
Example Test 
Example AnyExample 
Example Result 
Example (IO ()) 
Testable t => Example (QuickCheckProperty t) 

data AnyExample Source

An existentially quantified Example. This way they can be mixed within the same set of Specs

Constructors

forall a . Example a => AnyExample a 

Instances

pendingSource

Arguments

:: String

An explanation for why this behavior is pending.

-> Result 

Declare an example as not successful or failing but pending some other work. If you want to report on a behavior but don't have an example yet, use this.

 describe "fancyFormatter" [
   it "can format text in a way that everyone likes"
     (pending "waiting for clarification from the designers")
   ]

quantify :: Num a => a -> String -> StringSource

Create a more readable display of a quantity of something.