Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hedgehog.Extras.Test.Base
Synopsis
- propertyOnce :: HasCallStack => Integration () -> Property
- workspace :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (FilePath -> m ()) -> m ()
- moduleWorkspace :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (FilePath -> m ()) -> m ()
- note :: (MonadTest m, HasCallStack) => String -> m String
- note_ :: (MonadTest m, HasCallStack) => String -> m ()
- noteM :: (MonadTest m, MonadCatch m, HasCallStack) => m String -> m String
- noteM_ :: (MonadTest m, MonadCatch m, HasCallStack) => m String -> m ()
- noteIO :: (MonadTest m, MonadIO m, HasCallStack) => IO String -> m String
- noteIO_ :: (MonadTest m, MonadIO m, HasCallStack) => IO String -> m ()
- noteShow :: (MonadTest m, HasCallStack, Show a) => a -> m a
- noteShow_ :: (MonadTest m, HasCallStack, Show a) => a -> m ()
- noteShowM :: (MonadTest m, MonadCatch m, HasCallStack, Show a) => m a -> m a
- noteShowM_ :: (MonadTest m, MonadCatch m, HasCallStack, Show a) => m a -> m ()
- noteShowIO :: (MonadTest m, MonadIO m, HasCallStack, Show a) => IO a -> m a
- noteShowIO_ :: (MonadTest m, MonadIO m, HasCallStack, Show a) => IO a -> m ()
- noteEach :: (MonadTest m, HasCallStack, Show a, Traversable f) => f a -> m (f a)
- noteEach_ :: (MonadTest m, HasCallStack, Show a, Traversable f) => f a -> m ()
- noteEachM :: (MonadTest m, HasCallStack, Show a, Traversable f) => m (f a) -> m (f a)
- noteEachM_ :: (MonadTest m, HasCallStack, Show a, Traversable f) => m (f a) -> m ()
- noteEachIO :: (MonadTest m, MonadIO m, HasCallStack, Show a, Traversable f) => IO (f a) -> m (f a)
- noteEachIO_ :: (MonadTest m, MonadIO m, HasCallStack, Show a, Traversable f) => IO (f a) -> m ()
- noteTempFile :: (MonadTest m, HasCallStack) => FilePath -> FilePath -> m FilePath
- failWithCustom :: MonadTest m => CallStack -> Maybe Diff -> String -> m a
- failMessage :: MonadTest m => CallStack -> String -> m a
- assertByDeadlineM :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> m Bool -> m ()
- assertByDeadlineIO :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> IO Bool -> m ()
- assertByDeadlineMFinally :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> m Bool -> m () -> m ()
- assertByDeadlineIOFinally :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> IO Bool -> m () -> m ()
- assertM :: (MonadTest m, HasCallStack) => m Bool -> m ()
- assertIO :: (MonadTest m, MonadIO m, HasCallStack) => IO Bool -> m ()
- onFailure :: Integration () -> Integration ()
- type Integration a = PropertyT (ReaderT IntegrationState (ResourceT IO)) a
- release :: (MonadTest m, MonadIO m) => ReleaseKey -> m ()
- runFinallies :: Integration a -> Integration a
Documentation
propertyOnce :: HasCallStack => Integration () -> Property Source #
Run a property with only one test. This is intended for allowing hedgehog to run unit tests.
workspace :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (FilePath -> m ()) -> m () Source #
Create a workspace directory which will exist for at least the duration of the supplied block.
The directory will have the supplied prefix but contain a generated random suffix to prevent interference between tests
The directory will be deleted if the block succeeds, but left behind if the block fails.
moduleWorkspace :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (FilePath -> m ()) -> m () Source #
Create a workspace directory which will exist for at least the duration of the supplied block.
The directory will have the prefix as "$prefixPath/$moduleName" but contain a generated random suffix to prevent interference between tests
The directory will be deleted if the block succeeds, but left behind if the block fails.
note_ :: (MonadTest m, HasCallStack) => String -> m () Source #
Annotate the given string returning unit.
noteM :: (MonadTest m, MonadCatch m, HasCallStack) => m String -> m String Source #
Annotate the given string in a monadic context.
noteM_ :: (MonadTest m, MonadCatch m, HasCallStack) => m String -> m () Source #
Annotate the given string in a monadic context returning unit.
noteIO :: (MonadTest m, MonadIO m, HasCallStack) => IO String -> m String Source #
Annotate the given string in IO.
noteIO_ :: (MonadTest m, MonadIO m, HasCallStack) => IO String -> m () Source #
Annotate the given string in IO returning unit.
noteShow_ :: (MonadTest m, HasCallStack, Show a) => a -> m () Source #
Annotate the given value returning unit.
noteShowM :: (MonadTest m, MonadCatch m, HasCallStack, Show a) => m a -> m a Source #
Annotate the given value in a monadic context.
noteShowM_ :: (MonadTest m, MonadCatch m, HasCallStack, Show a) => m a -> m () Source #
Annotate the given value in a monadic context returning unit.
noteShowIO :: (MonadTest m, MonadIO m, HasCallStack, Show a) => IO a -> m a Source #
Annotate the given value in IO.
noteShowIO_ :: (MonadTest m, MonadIO m, HasCallStack, Show a) => IO a -> m () Source #
Annotate the given value in IO returning unit.
noteEach :: (MonadTest m, HasCallStack, Show a, Traversable f) => f a -> m (f a) Source #
Annotate the each value in the given traversable.
noteEach_ :: (MonadTest m, HasCallStack, Show a, Traversable f) => f a -> m () Source #
Annotate the each value in the given traversable returning unit.
noteEachM :: (MonadTest m, HasCallStack, Show a, Traversable f) => m (f a) -> m (f a) Source #
Annotate the each value in the given traversable in a monadic context.
noteEachM_ :: (MonadTest m, HasCallStack, Show a, Traversable f) => m (f a) -> m () Source #
Annotate the each value in the given traversable in a monadic context returning unit.
noteEachIO :: (MonadTest m, MonadIO m, HasCallStack, Show a, Traversable f) => IO (f a) -> m (f a) Source #
Annotate the each value in the given traversable in IO.
noteEachIO_ :: (MonadTest m, MonadIO m, HasCallStack, Show a, Traversable f) => IO (f a) -> m () Source #
Annotate the each value in the given traversable in IO returning unit.
noteTempFile :: (MonadTest m, HasCallStack) => FilePath -> FilePath -> m FilePath Source #
Return the test file path after annotating it relative to the project root directory
failWithCustom :: MonadTest m => CallStack -> Maybe Diff -> String -> m a Source #
Takes a CallStack
so the error can be rendered at the appropriate call site.
failMessage :: MonadTest m => CallStack -> String -> m a Source #
Takes a CallStack
so the error can be rendered at the appropriate call site.
assertByDeadlineM :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> m Bool -> m () Source #
Run the operation f
once a second until it returns True
or the deadline expires.
Expiration of the deadline results in an assertion failure
assertByDeadlineIO :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> IO Bool -> m () Source #
Run the operation f
once a second until it returns True
or the deadline expires.
Expiration of the deadline results in an assertion failure
assertByDeadlineMFinally :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> m Bool -> m () -> m () Source #
Run the operation f
once a second until it returns True
or the deadline expires.
The action g
is run after expiration of the deadline, but before failure allowing for
additional annotations to be presented.
Expiration of the deadline results in an assertion failure
assertByDeadlineIOFinally :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> IO Bool -> m () -> m () Source #
Run the operation f
once a second until it returns True
or the deadline expires.
The action g
is run after expiration of the deadline, but before failure allowing for
additional annotations to be presented.
Expiration of the deadline results in an assertion failure
assertM :: (MonadTest m, HasCallStack) => m Bool -> m () Source #
Run the monadic action f
and assert the return value is True
.
assertIO :: (MonadTest m, MonadIO m, HasCallStack) => IO Bool -> m () Source #
Run the IO action f
and assert the return value is True
.
onFailure :: Integration () -> Integration () Source #
type Integration a = PropertyT (ReaderT IntegrationState (ResourceT IO)) a Source #
runFinallies :: Integration a -> Integration a Source #