Safe Haskell | None |
---|
- class Example a
- data Pending
- describe :: String -> Spec -> Spec
- context :: String -> Spec -> Spec
- it :: Example v => String -> v -> Spec
- pending :: String -> Pending
- hspec :: Spec -> IO ()
- hspecB :: Spec -> IO Bool
- hHspec :: Handle -> Spec -> IO Summary
- data Summary = Summary {}
- runSpecM :: Spec -> [Spec]
- fromSpecList :: [Spec] -> Spec
Types
A type class for examples.
Defining a spec
describe :: String -> Spec -> SpecSource
The describe
function combines a list of specs into a larger spec.
it :: Example v => String -> v -> SpecSource
Create a set of specifications for a specific type being described. Once you know what you want specs for, use this.
describe "abs" $ do it "returns a positive number given a negative number" $ abs (-1) == 1
pending :: String -> PendingSource
A pending example.
If you want to report on a behavior but don't have an example yet, use this.
describe "fancyFormatter" $ do it "can format text in a way that everyone likes" $ pending
You can give an optional reason for why it's pending.
describe "fancyFormatter" $ do it "can format text in a way that everyone likes" $ pending "waiting for clarification from the designers"
Running a spec
Create a document of the given spec and write it to stdout.
Exit the program with exitSuccess
if all examples passed, with
exitFailure
otherwise.
hHspec :: Handle -> Spec -> IO SummarySource
Create a document of the given specs and write it to the given handle.
writeReport filename specs = withFile filename WriteMode (\h -> hHspec h specs)
Summary of a test run.
Interface to the non-monadic API
fromSpecList :: [Spec] -> SpecSource
Convert a non-monadic spec into a monadic spec.