polysemy-test-0.1.0.0: Polysemy effects for testing
Safe HaskellNone
LanguageHaskell2010

Polysemy.Test.Data.Test

Synopsis

Documentation

data Test :: Effect where Source #

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

Constructors

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

Instances

Instances details
type DefiningModule Test Source # 
Instance details

Defined in Polysemy.Test.Data.Test

type DefiningModule Test = "Polysemy.Test.Data.Test"

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

Return the base dir in which tests are executed.

tempDir :: forall r. 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. 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. Member Test r => Path Rel File -> Sem r Text Source #

Read the contents of a temporary file.

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

Construct a path relative to the fixture directory.

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

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