Safe Haskell | Safe-Infered |
---|
This module contains the core types, constructors, classes, instances, and utility functions common to hspec.
- data SpecTree a
- = SpecGroup String [SpecTree a]
- | SpecExample String a
- class Example a where
- evaluateExample :: a -> IO Result
- data Result
- descriptions :: Specs -> Specs
- describe :: String -> [Spec] -> Spec
- it :: Example a => String -> a -> Spec
- data Spec
- type Specs = [Spec]
- type UnevaluatedSpec = Spec
- type EvaluatedSpec = SpecTree Result
- quantify :: (Show a, Num a, Eq a) => a -> String -> String
- type AnyExample = IO Result
- safeEvaluateExample :: AnyExample -> IO Result
- success :: [EvaluatedSpec] -> Bool
- failure :: [EvaluatedSpec] -> Bool
- isFailure :: Result -> Bool
- failedCount :: [EvaluatedSpec] -> Int
Documentation
Internal representation of a spec.
This will be made abstract with the next release. If you still need access to any constructors, open an issue and describe your use case: https://github.com/hspec/hspec/issues
SpecGroup String [SpecTree a] | |
SpecExample String a |
A type class for examples.
To use an HUnit Test
or an Assertion
as an example
you need to import Test.Hspec.HUnit.
To use a QuickCheck Property
as an example you need to
import Test.Hspec.QuickCheck.
evaluateExample :: a -> IO ResultSource
The result of running an example.
descriptions :: Specs -> SpecsSource
DEPRECATED: This is no longer needed (it's just an alias for id
now).
it :: Example a => String -> a -> SpecSource
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) ]
type UnevaluatedSpec = SpecSource
type EvaluatedSpec = SpecTree ResultSource
quantify :: (Show a, Num a, Eq a) => a -> String -> StringSource
Create a more readable display of a quantity of something.
Deprecated types and functions
The following types and functions are deprecated and will be removed with the next release.
If you still need any of those, please open an issue and describe your use case: https://github.com/hspec/hspec/issues
type AnyExample = IO ResultSource
success :: [EvaluatedSpec] -> BoolSource
failure :: [EvaluatedSpec] -> BoolSource
failedCount :: [EvaluatedSpec] -> IntSource