Test.Hspec.Runner
Description
This module contains the runners that take a set of specs, evaluate their examples, and report to a given handle.
- type Specs = [IO Spec]
- hspec :: IO Specs -> IO [Spec]
- hspecX :: IO Specs -> IO a
- hspecB :: IO Specs -> IO Bool
- hHspec :: Handle -> IO Specs -> IO [Spec]
- hHspecWithFormat :: Formatter -> Handle -> IO Specs -> IO [Spec]
- describe :: String -> [IO (String, Result)] -> IO [IO Spec]
- it :: SpecVerifier a => String -> a -> IO (String, Result)
- toExitCode :: Bool -> ExitCode
Documentation
hHspec :: Handle -> IO Specs -> IO [Spec]Source
Create a document of the given specs and write it to the given handle.
writeReport filename specs = withFile filename WriteMode (\ h -> hHspec h specs)
hHspecWithFormat :: Formatter -> Handle -> IO Specs -> IO [Spec]Source
Create a document of the given specs and write it to the given handle. THIS IS LIKELY TO CHANGE
Arguments
| :: String | The name of what is being described, usually a function or type. |
| -> [IO (String, Result)] | A list of behaviors and examples, created by a list of |
| -> IO [IO Spec] |
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)
]
Arguments
| :: SpecVerifier a | |
| => String | A description of this behavior. |
| -> a | An example for this behavior. |
| -> IO (String, Result) |
Create a description and example of a behavior, a list of these
is used by describe. Once you know what you want to specify, use this.
describe "closeEnough" [
it "is true if two numbers are almost the same"
(1.001 `closeEnough` 1.002),
it "is false if two numbers are not almost the same"
(not $ 1.001 `closeEnough` 1.003)
]
toExitCode :: Bool -> ExitCodeSource