Safe Haskell | Safe-Infered |
---|
This module contains the core types, constructors, classes, instances, and utility functions common to hspec.
- data Result
- type UnevaluatedSpec = Spec AnyExample
- type EvaluatedSpec = Spec Result
- data Spec a
- = SpecGroup String [Spec a]
- | SpecExample String a
- describe :: String -> [Spec a] -> Spec a
- descriptions :: [Spec a] -> [Spec a]
- safeEvaluateExample :: AnyExample -> IO Result
- it :: Example a => String -> a -> UnevaluatedSpec
- class Example a where
- evaluateExample :: a -> IO Result
- data AnyExample = forall a . Example a => AnyExample a
- pending :: String -> Result
- failedCount :: [EvaluatedSpec] -> Int
- failure :: [EvaluatedSpec] -> Bool
- success :: [EvaluatedSpec] -> Bool
- isFailure :: Result -> Bool
- quantify :: (Show a, Num a, Eq a) => a -> String -> String
Documentation
The result of running an example.
type UnevaluatedSpec = Spec AnyExampleSource
type EvaluatedSpec = Spec ResultSource
descriptions :: [Spec a] -> [Spec a]Source
DEPRECATED: This is no longer needed (it's just an alias for id
now).
it :: Example a => String -> a -> UnevaluatedSpecSource
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) ]
evaluateExample :: a -> IO ResultSource
data AnyExample Source
An existentially quantified Example
. This way they can be mixed within the same set of Specs
forall a . Example a => AnyExample a |
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") ]
failedCount :: [EvaluatedSpec] -> IntSource
failure :: [EvaluatedSpec] -> BoolSource
success :: [EvaluatedSpec] -> BoolSource