sandwich-hedgehog-0.1.3.0: Sandwich integration with Hedgehog
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Sandwich.Hedgehog

Description

Functions for introducing Hedgehog tests into a Sandwich test tree. Modelled after Hspec's version.

Documentation can be found here.

Synopsis

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

Instances details
Show HedgehogParams Source # 
Instance details

Defined in Test.Sandwich.Hedgehog

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 #

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 #