Stability | unstable |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
Deprecated: use Test.Hspec.Core.Spec instead
Synopsis
- pendingWith :: HasCallStack -> String -> Expectation
- pending :: HasCallStack -> Expectation
- sequential :: SpecWith a -> SpecWith a
- parallel :: SpecWith a -> SpecWith a
- xspecify :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a)
- xit :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a)
- specify :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a)
- xcontext :: HasCallStack => String -> SpecWith a -> SpecWith a
- xdescribe :: HasCallStack => String -> SpecWith a -> SpecWith a
- context :: HasCallStack => String -> SpecWith a -> SpecWith a
- modifyParams :: (Params -> Params) -> SpecWith a -> SpecWith a
- mapSpecItem_ :: (Item a -> Item a) -> SpecWith a -> SpecWith a
- mapSpecItem :: (ActionWith a -> ActionWith b) -> (Item a -> Item b) -> SpecWith a -> SpecWith b
- runIO :: IO r -> SpecM a r
- fromSpecList :: [SpecTree a] -> SpecWith a
- runSpecM :: SpecWith a -> IO [SpecTree a]
- type Spec = SpecWith ()
- type SpecWith a = SpecM a ()
- newtype SpecM a r = SpecM (WriterT [SpecTree a] IO r)
- location :: HasCallStack -> Maybe Location
- specItem :: (HasCallStack, Example a) => String -> a -> SpecTree (Arg a)
- specGroup :: HasCallStack => String -> [SpecTree a] -> SpecTree a
- data Tree c a
- type SpecTree a = Tree (ActionWith a) (Item a)
- data Item a = Item {
- itemRequirement :: String
- itemLocation :: Maybe Location
- itemIsParallelizable :: Maybe Bool
- itemExample :: Params -> (ActionWith a -> IO ()) -> ProgressCallback -> IO Result
- safeEvaluateExample :: Example e => e -> Params -> (ActionWith (Arg e) -> IO ()) -> ProgressCallback -> IO Result
- defaultParams :: Params
- class Example e where
- data Params = Params {}
- type Progress = (Int, Int)
- type ProgressCallback = Progress -> IO ()
- type ActionWith a = a -> IO ()
- data Result = Result {}
- data ResultStatus
- data FailureReason
- data Location = Location {}
- describe :: String -> [SpecTree a] -> SpecTree a
- it :: Example a => String -> a -> SpecTree (Arg a)
Documentation
pendingWith :: HasCallStack -> String -> Expectation #
pendingWith
is similar to pending
, but it takes an additional string
argument that can be used to specify the reason for why the spec item is pending.
pending :: HasCallStack -> Expectation #
pending
can be used to mark a spec item as pending.
If you want to textually specify a behavior but do not have an example yet, use this:
describe "fancyFormatter" $ do it "can format text in a way that everyone likes" $ pending
sequential :: SpecWith a -> SpecWith a #
sequential
marks all spec items of the given spec to be evaluated sequentially.
parallel :: SpecWith a -> SpecWith a #
parallel
marks all spec items of the given spec to be safe for parallel
evaluation.
xspecify :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) #
xspecify
is an alias for xit
.
specify :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) #
specify
is an alias for it
.
mapSpecItem :: (ActionWith a -> ActionWith b) -> (Item a -> Item b) -> SpecWith a -> SpecWith b #
Run an IO action while constructing the spec tree.
SpecM
is a monad to construct a spec tree, without executing any spec
items. runIO
allows you to run IO actions during this construction phase.
The IO action is always run when the spec tree is constructed (e.g. even
when --dry-run
is specified).
If you do not need the result of the IO action to construct the spec tree,
beforeAll
may be more suitable for your use case.
A writer monad for SpecTree
forests
location :: HasCallStack -> Maybe Location #
specItem :: (HasCallStack, Example a) => String -> a -> SpecTree (Arg a) #
The specItem
function creates a spec item.
specGroup :: HasCallStack => String -> [SpecTree a] -> SpecTree a #
The specGroup
function combines a list of specs into a larger spec.
Internal tree data structure
Instances
Functor (Tree c) | |
Foldable (Tree c) | |
Defined in Test.Hspec.Core.Tree fold :: Monoid m => Tree c m -> m # foldMap :: Monoid m => (a -> m) -> Tree c a -> m # foldr :: (a -> b -> b) -> b -> Tree c a -> b # foldr' :: (a -> b -> b) -> b -> Tree c a -> b # foldl :: (b -> a -> b) -> b -> Tree c a -> b # foldl' :: (b -> a -> b) -> b -> Tree c a -> b # foldr1 :: (a -> a -> a) -> Tree c a -> a # foldl1 :: (a -> a -> a) -> Tree c a -> a # elem :: Eq a => a -> Tree c a -> Bool # maximum :: Ord a => Tree c a -> a # minimum :: Ord a => Tree c a -> a # | |
Traversable (Tree c) | |
type SpecTree a = Tree (ActionWith a) (Item a) #
A tree is used to represent a spec internally. The tree is parametrize over the type of cleanup actions and the type of the actual spec items.
Item
is used to represent spec items internally. A spec item consists of:
- a textual description of a desired behavior
- an example for that behavior
- additional meta information
Everything that is an instance of the Example
type class can be used as an
example, including QuickCheck properties, Hspec expectations and HUnit
assertions.
Item | |
|
safeEvaluateExample :: Example e => e -> Params -> (ActionWith (Arg e) -> IO ()) -> ProgressCallback -> IO Result #
defaultParams :: Params #
A type class for examples
evaluateExample :: e -> Params -> (ActionWith (Arg e) -> IO ()) -> ProgressCallback -> IO Result #
Instances
type ProgressCallback = Progress -> IO () #
type ActionWith a = a -> IO () #
An IO
action that expects an argument of type a
The result of running an example
Instances
Show Result | |
Example Result | |
Defined in Test.Hspec.Core.Example evaluateExample :: Result -> Params -> (ActionWith (Arg Result) -> IO ()) -> ProgressCallback -> IO Result # | |
Example (a -> Result) | |
Defined in Test.Hspec.Core.Example evaluateExample :: (a -> Result) -> Params -> (ActionWith (Arg (a -> Result)) -> IO ()) -> ProgressCallback -> IO Result # | |
type Arg Result | |
Defined in Test.Hspec.Core.Example | |
type Arg (a -> Result) | |
Defined in Test.Hspec.Core.Example |
data ResultStatus #
Instances
Show ResultStatus | |
Defined in Test.Hspec.Core.Example showsPrec :: Int -> ResultStatus -> ShowS # show :: ResultStatus -> String # showList :: [ResultStatus] -> ShowS # | |
Exception ResultStatus | |
Defined in Test.Hspec.Core.Example |
data FailureReason #
NoReason | |
Reason String | |
ExpectedButGot (Maybe String) String String | |
Error (Maybe String) SomeException |
Instances
Show FailureReason | |
Defined in Test.Hspec.Core.Example showsPrec :: Int -> FailureReason -> ShowS # show :: FailureReason -> String # showList :: [FailureReason] -> ShowS # | |
NFData FailureReason | |
Defined in Test.Hspec.Core.Example rnf :: FailureReason -> () # |
Location
is used to represent source locations.
Location | |
|