-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Testing Framework for Haskell -- -- Hspec is a testing framework for Haskell. Some of Hspec's distinctive -- features are: -- -- -- -- The Hspec Manual is at https://hspec.github.io/. @package hspec @version 2.11.8 -- | Warning: This module is used by hspec-discover. It is not -- part of the public API and may change at any time. module Test.Hspec.Discover type Spec = SpecWith () -- | Run a given spec and write a report to stdout. Exit with -- exitFailure if at least one spec item fails. -- -- Note: hspec handles command-line options and reads -- config files. This is not always desirable. Use evalSpec and -- runSpecForest if you need more control over these aspects. hspec :: Spec -> IO () class IsFormatter a toFormatter :: IsFormatter a => a -> IO Formatter hspecWithFormatter :: IsFormatter a => a -> Spec -> IO () postProcessSpec :: FilePath -> Spec -> Spec -- | The describe function combines a list of specs into a larger -- spec. describe :: HasCallStack => String -> SpecWith a -> SpecWith a instance Test.Hspec.Discover.IsFormatter (GHC.Types.IO Test.Hspec.Core.Formatters.V1.Monad.Formatter) instance Test.Hspec.Discover.IsFormatter Test.Hspec.Core.Formatters.V1.Monad.Formatter -- | Deprecated: Use Test.Hspec.Api.Formatters.V1 instead. module Test.Hspec.Formatters module Test.Hspec.Runner -- | Hspec is a testing framework for Haskell. -- -- This is the library reference for Hspec. The User's Manual -- contains more in-depth documentation. module Test.Hspec type Spec = SpecWith () type SpecWith a = SpecM a () type family Arg e -- | A type class for examples class () => Example e -- | The it function creates a spec item. -- -- A spec item consists of: -- -- -- --
--   describe "absolute" $ do
--     it "returns a positive number when given a negative number" $
--       absolute (-1) == 1
--   
it :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) -- | specify is an alias for it. specify :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) -- | The describe function combines a list of specs into a larger -- spec. describe :: HasCallStack => String -> SpecWith a -> SpecWith a -- | context is an alias for describe. context :: HasCallStack => String -> SpecWith a -> SpecWith a -- | example is a type restricted version of id. It can be -- used to get better error messages on type mismatches. -- -- Compare e.g. -- --
--   it "exposes some behavior" $ example $ do
--     putStrLn
--   
-- -- with -- --
--   it "exposes some behavior" $ do
--     putStrLn
--   
example :: Expectation -> Expectation -- | parallel marks all spec items of the given spec to be safe for -- parallel evaluation. parallel :: SpecWith a -> SpecWith a -- | sequential marks all spec items of the given spec to be -- evaluated sequentially. sequential :: SpecWith a -> SpecWith a -- | 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. runIO :: IO r -> SpecM a r -- | 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
--   
pending :: HasCallStack => 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. pendingWith :: HasCallStack => String -> Expectation -- | Changing it to xit marks the corresponding spec item as -- pending. -- -- This can be used to temporarily disable a spec item. xit :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) -- | xspecify is an alias for xit. xspecify :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) -- | Changing describe to xdescribe marks all spec items of -- the corresponding subtree as pending. -- -- This can be used to temporarily disable spec items. xdescribe :: HasCallStack => String -> SpecWith a -> SpecWith a -- | xcontext is an alias for xdescribe. xcontext :: HasCallStack => String -> SpecWith a -> SpecWith a -- | focus focuses all spec items of the given spec. -- -- Applying focus to a spec with focused spec items has no effect. focus :: SpecWith a -> SpecWith a -- | fit is an alias for fmap focus . it fit :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) -- | fspecify is an alias for fit. fspecify :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) -- | fdescribe is an alias for fmap focus . describe fdescribe :: HasCallStack => String -> SpecWith a -> SpecWith a -- | fcontext is an alias for fdescribe. fcontext :: HasCallStack => String -> SpecWith a -> SpecWith a -- | An IO action that expects an argument of type a type ActionWith a = a -> IO () -- | Run a custom action before every spec item. before :: IO a -> SpecWith a -> Spec -- | Run a custom action before every spec item. before_ :: IO () -> SpecWith a -> SpecWith a -- | Run a custom action before every spec item. beforeWith :: (b -> IO a) -> SpecWith a -> SpecWith b -- | Run a custom action before the first spec item. beforeAll :: HasCallStack => IO a -> SpecWith a -> Spec -- | Run a custom action before the first spec item. beforeAll_ :: HasCallStack => IO () -> SpecWith a -> SpecWith a -- | Run a custom action with an argument before the first spec item. beforeAllWith :: HasCallStack => (b -> IO a) -> SpecWith a -> SpecWith b -- | Run a custom action after every spec item. after :: ActionWith a -> SpecWith a -> SpecWith a -- | Run a custom action after every spec item. after_ :: IO () -> SpecWith a -> SpecWith a -- | Run a custom action after the last spec item. afterAll :: HasCallStack => ActionWith a -> SpecWith a -> SpecWith a -- | Run a custom action after the last spec item. afterAll_ :: HasCallStack => IO () -> SpecWith a -> SpecWith a -- | Run a custom action before and/or after every spec item. around :: (ActionWith a -> IO ()) -> SpecWith a -> Spec -- | Run a custom action before and/or after every spec item. around_ :: (IO () -> IO ()) -> SpecWith a -> SpecWith a -- | Run a custom action before and/or after every spec item. aroundWith :: (ActionWith a -> ActionWith b) -> SpecWith a -> SpecWith b -- | Wrap an action around the given spec. aroundAll :: HasCallStack => (ActionWith a -> IO ()) -> SpecWith a -> Spec -- | Wrap an action around the given spec. aroundAll_ :: HasCallStack => (IO () -> IO ()) -> SpecWith a -> SpecWith a -- | Wrap an action around the given spec. Changes the arg type inside. aroundAllWith :: HasCallStack => (ActionWith a -> ActionWith b) -> SpecWith a -> SpecWith b -- | Modify the subject under test. -- -- Note that this resembles a contravariant functor on the first type -- parameter of SpecM. This is because the subject is passed -- inwards, as an argument to the spec item. mapSubject :: (b -> a) -> SpecWith a -> SpecWith b -- | Ignore the subject under test for a given spec. ignoreSubject :: SpecWith () -> SpecWith a -- | Run a given spec and write a report to stdout. Exit with -- exitFailure if at least one spec item fails. -- -- Note: hspec handles command-line options and reads -- config files. This is not always desirable. Use evalSpec and -- runSpecForest if you need more control over these aspects. hspec :: Spec -> IO () module Test.Hspec.QuickCheck -- | Use modified Args for given spec. modifyArgs :: (Args -> Args) -> SpecWith a -> SpecWith a -- | Use a modified maxSuccess for given spec. modifyMaxSuccess :: (Int -> Int) -> SpecWith a -> SpecWith a -- | Use a modified maxDiscardRatio for given spec. modifyMaxDiscardRatio :: (Int -> Int) -> SpecWith a -> SpecWith a -- | Use a modified maxSize for given spec. modifyMaxSize :: (Int -> Int) -> SpecWith a -> SpecWith a -- | Use a modified maxShrinks for given spec. modifyMaxShrinks :: (Int -> Int) -> SpecWith a -> SpecWith a -- |
--   prop ".." $
--     ..
--   
-- -- is a shortcut for -- --
--   it ".." $ property $
--     ..
--   
prop :: (HasCallStack, Testable prop) => String -> prop -> Spec -- |
--   xprop ".." $
--     ..
--   
-- -- is a shortcut for -- --
--   xit ".." $ property $
--     ..
--   
xprop :: (HasCallStack, Testable prop) => String -> prop -> Spec -- |
--   fprop ".." $
--     ..
--   
-- -- is a shortcut for -- --
--   fit ".." $ property $
--     ..
--   
fprop :: (HasCallStack, Testable prop) => String -> prop -> Spec