polysemy-test-0.7.0.0: Polysemy Effects for Testing
Safe HaskellSafe-Inferred
LanguageHaskell2010

Polysemy.Test.Run

Description

Test Interpreters, Internal

Synopsis

Documentation

interpretTestKeepTemp :: Members [Error TestError, Embed IO] r => Path Abs Dir -> InterpreterFor Test r Source #

Interpret Test so that fixtures are read from the directory base and temp operations are performed in tmppolysemy-test-XXX.

This library uses Path for all file system related tasks, so in order to construct paths manually, you'll have to use the quasiquoters absdir and reldir or the functions parseAbsDir and parseRelDir.

interpretTest :: Members [Error TestError, Resource, Embed IO] r => Path Abs Dir -> InterpreterFor Test r Source #

like interpretTestKeepTemp, but deletes the temp dir after the test.

interpretTestInSubdir :: Members [Error TestError, Resource, Embed IO] r => Text -> InterpreterFor Test r Source #

Call interpretTest with the subdirectory prefix of the current working directory as the base dir, which is most likely something like test. This is not necessarily consistent, it depends on which directory your test runner uses as cwd.

unwrapLiftedTestT :: forall m r a. Monad m => Member (Embed m) r => Sem (Fail ': (Error TestError ': (Hedgehog m ': (Error Failure ': r)))) a -> Sem r (Journal, Either Failure a) Source #

Run Hedgehog and its dependent effects that correspond to the monad stack of TestT, exposing the monadic state.

semToTestT :: Monad m => Member (Embed m) r => (forall x. Sem r x -> m x) -> Sem (Fail ': (Error TestError ': (Hedgehog m ': (Error Failure ': r)))) a -> TestT m a Source #

Run Hedgehog with unwrapLiftedTestT and wrap it back into the TestT stack.

runTest :: Path Abs Dir -> Sem TestEffects a -> TestT IO a Source #

Convenience combinator that runs both Hedgehog and Test and rewraps the result in TestT IO, ready for execution as a property.

runTestAutoWith :: HasCallStack => Members [Resource, Embed IO] r => (forall x. Sem r x -> IO x) -> Sem (Test ': (Fail ': (Error TestError ': (Hedgehog IO ': (Error Failure ': r))))) a -> TestT IO a Source #

Wrapper for semToTestT that uses the call stack to determine the base dir of the test run. Note that if you wrap this function, you'll have to use the HasCallStack constraint to supply the implicit CallStack.