polysemy-test-0.10.0.1: Polysemy effects for testing
Safe HaskellNone
LanguageGHC2021

Polysemy.Test.Data.Test

Description

Test Effect, Internal

Synopsis

Documentation

data Test (a :: Type -> Type) b where Source #

Operations for interacting with fixtures and temp files in a test.

Constructors

TestDir :: forall (a :: Type -> Type). Test a (Path Abs Dir) 
TempDir :: forall (a :: Type -> Type). Path Rel Dir -> Test a (Path Abs Dir) 
TempFile :: forall (a :: Type -> Type). [Text] -> Path Rel File -> Test a (Path Abs File) 
TempFileContent :: forall (a :: Type -> Type). Path Rel File -> Test a Text 
FixturePath :: forall p (a :: Type -> Type). Path Rel p -> Test a (Path Abs p) 
Fixture :: forall (a :: Type -> Type). Path Rel File -> Test a Text 

testDir :: forall (r :: EffectRow). Member Test r => Sem r (Path Abs Dir) Source #

Return the base dir in which tests are executed.

tempDir :: forall (r :: EffectRow). Member Test r => Path Rel Dir -> Sem r (Path Abs Dir) Source #

Create a subdirectory of the directory for temporary files and return its absolute path.

tempFile :: forall (r :: EffectRow). Member Test r => [Text] -> Path Rel File -> Sem r (Path Abs File) Source #

Write the specified lines of Text to a file under the temp dir and return its absolute path.

tempFileContent :: forall (r :: EffectRow). Member Test r => Path Rel File -> Sem r Text Source #

Read the contents of a temporary file.

fixturePath :: forall p (r :: EffectRow). Member Test r => Path Rel p -> Sem r (Path Abs p) Source #

Construct a path relative to the fixture directory.

fixture :: forall (r :: EffectRow). Member Test r => Path Rel File -> Sem r Text Source #

Read the contents of a file relative to the fixture directory.