Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Functions for introducing Hedgehog tests into a Sandwich test tree. Modelled after Hspec's version.
Documentation can be found here.
Synopsis
- introduceHedgehog :: (MonadIO m, MonadBaseControl IO m) => SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m ()
- introduceHedgehog' :: (MonadIO m, MonadBaseControl IO m) => HedgehogParams -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m ()
- introduceHedgehog'' :: (MonadIO m, MonadBaseControl IO m) => String -> HedgehogParams -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m ()
- prop :: (HasCallStack, HasHedgehogContext context, MonadIO m, MonadCatch m) => String -> PropertyT (ExampleT context m) () -> Free (SpecCommand context m) ()
- data HedgehogParams
- defaultHedgehogParams :: HedgehogParams
- hedgehogDiscardLimit :: HedgehogParams -> Maybe DiscardLimit
- hedgehogShrinkLimit :: HedgehogParams -> Maybe ShrinkLimit
- hedgehogShrinkRetries :: HedgehogParams -> Maybe ShrinkRetries
- hedgehogTerminationCriteria :: HedgehogParams -> Maybe TerminationCriteria
- hedgehogSkip :: HedgehogParams -> Maybe Skip
- hedgehogSize :: HedgehogParams -> Maybe Size
- hedgehogSeed :: HedgehogParams -> Maybe Seed
- introduceHedgehogCommandLineOptions :: forall a m context. (MonadIO m, MonadBaseControl IO m, HasLabel context "commandLineOptions" (CommandLineOptions a), MonadReader context m) => SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m ()
- introduceHedgehogCommandLineOptions' :: forall a m context. (MonadIO m, MonadBaseControl IO m, HasLabel context "commandLineOptions" (CommandLineOptions a), MonadReader context m) => HedgehogParams -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m ()
- introduceHedgehogCommandLineOptions'' :: forall a m context. (MonadIO m, MonadBaseControl IO m, HasLabel context "commandLineOptions" (CommandLineOptions a), MonadReader context m) => String -> HedgehogParams -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m ()
- addCommandLineOptions :: CommandLineOptions a -> HedgehogParams -> HedgehogParams
- modifyArgs :: (HasHedgehogContext context, Monad m) => (HedgehogParams -> HedgehogParams) -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m ()
- modifyDiscardLimit :: (HasHedgehogContext context, Monad m) => (Maybe DiscardLimit -> Maybe DiscardLimit) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m ()
- modifyShrinkLimit :: (HasHedgehogContext context, Monad m) => (Maybe ShrinkLimit -> Maybe ShrinkLimit) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m ()
- modifyShrinkRetries :: (HasHedgehogContext context, Monad m) => (Maybe ShrinkRetries -> Maybe ShrinkRetries) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m ()
- modifyTerminationCriteria :: (HasHedgehogContext context, Monad m) => (Maybe TerminationCriteria -> Maybe TerminationCriteria) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m ()
- modifySkip :: (HasHedgehogContext context, Monad m) => (Maybe Skip -> Maybe Skip) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m ()
- modifySize :: (HasHedgehogContext context, Monad m) => (Maybe Size -> Maybe Size) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m ()
- modifySeed :: (HasHedgehogContext context, Monad m) => (Maybe Seed -> Maybe Seed) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m ()
- type HasHedgehogContext context = HasLabel context "hedgehogContext" HedgehogContext
Introducing a Hedgehog context
introduceHedgehog :: (MonadIO m, MonadBaseControl IO m) => SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m () Source #
Same as introduceHedgehog'
but with default HedgehogParams
.
introduceHedgehog' :: (MonadIO m, MonadBaseControl IO m) => HedgehogParams -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m () Source #
Same as introduceHedgehog''
but with a default message.
introduceHedgehog'' :: (MonadIO m, MonadBaseControl IO m) => String -> HedgehogParams -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m () Source #
Introduce HedgehogParams
with configurable message.
Prop
prop :: (HasCallStack, HasHedgehogContext context, MonadIO m, MonadCatch m) => String -> PropertyT (ExampleT context m) () -> Free (SpecCommand context m) () Source #
Similar to it
. Runs the given propery with Hedgehog using the currently introduced HedgehogParams
. Throws an appropriate exception on failure.
Params
data HedgehogParams Source #
Instances
Show HedgehogParams Source # | |
Defined in Test.Sandwich.Hedgehog showsPrec :: Int -> HedgehogParams -> ShowS # show :: HedgehogParams -> String # showList :: [HedgehogParams] -> ShowS # |
hedgehogDiscardLimit :: HedgehogParams -> Maybe DiscardLimit Source #
The number of times a property is allowed to discard before the test runner gives up.
hedgehogShrinkLimit :: HedgehogParams -> Maybe ShrinkLimit Source #
The number of times a property is allowed to shrink before the test runner gives up and prints the counterexample.
hedgehogShrinkRetries :: HedgehogParams -> Maybe ShrinkRetries Source #
The number of times to re-run a test during shrinking.
hedgehogTerminationCriteria :: HedgehogParams -> Maybe TerminationCriteria Source #
Control when the test runner should terminate.
hedgehogSkip :: HedgehogParams -> Maybe Skip Source #
Control where to start running a property's tests
hedgehogSize :: HedgehogParams -> Maybe Size Source #
Size of the randomly-generated data.
hedgehogSeed :: HedgehogParams -> Maybe Seed Source #
Random number generator seed.
Versions that can be configured with built-in command line arguments.
introduceHedgehogCommandLineOptions :: forall a m context. (MonadIO m, MonadBaseControl IO m, HasLabel context "commandLineOptions" (CommandLineOptions a), MonadReader context m) => SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m () Source #
Same as introduceHedgehogCommandLineOptions'
but with default HedgehogParams
.
introduceHedgehogCommandLineOptions' :: forall a m context. (MonadIO m, MonadBaseControl IO m, HasLabel context "commandLineOptions" (CommandLineOptions a), MonadReader context m) => HedgehogParams -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m () Source #
Same as introduceHedgehogCommandLineOptions''
but with a default message.
introduceHedgehogCommandLineOptions'' :: forall a m context. (MonadIO m, MonadBaseControl IO m, HasLabel context "commandLineOptions" (CommandLineOptions a), MonadReader context m) => String -> HedgehogParams -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m () Source #
Introduce HedgehogParams
with configurable message, overriding those parameters with any command line options passed.
Modifying Hedgehog args
modifyArgs :: (HasHedgehogContext context, Monad m) => (HedgehogParams -> HedgehogParams) -> SpecFree (LabelValue "hedgehogContext" HedgehogContext :> context) m () -> SpecFree context m () Source #
Modify the HedgehogParams
for the given spec.
modifyDiscardLimit :: (HasHedgehogContext context, Monad m) => (Maybe DiscardLimit -> Maybe DiscardLimit) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m () Source #
Modify the DiscardLimit
for the given spec.
modifyShrinkLimit :: (HasHedgehogContext context, Monad m) => (Maybe ShrinkLimit -> Maybe ShrinkLimit) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m () Source #
Modify the ShrinkLimit
for the given spec.
modifyShrinkRetries :: (HasHedgehogContext context, Monad m) => (Maybe ShrinkRetries -> Maybe ShrinkRetries) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m () Source #
Modify the ShrinkRetries
for the given spec.
modifyTerminationCriteria :: (HasHedgehogContext context, Monad m) => (Maybe TerminationCriteria -> Maybe TerminationCriteria) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m () Source #
Modify the TerminationCriteria
for the given spec.
modifySkip :: (HasHedgehogContext context, Monad m) => (Maybe Skip -> Maybe Skip) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m () Source #
Modify the Skip
for the given spec.
modifySize :: (HasHedgehogContext context, Monad m) => (Maybe Size -> Maybe Size) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m () Source #
Modify the Size
for the given spec.
modifySeed :: (HasHedgehogContext context, Monad m) => (Maybe Seed -> Maybe Seed) -> SpecFree (HedgehogContextLabel context) m () -> SpecFree context m () Source #
Modify the Seed
for the given spec.
Misc
type HasHedgehogContext context = HasLabel context "hedgehogContext" HedgehogContext Source #