skeletest
Safe HaskellNone
LanguageGHC2021

Skeletest.Internal.Fixtures

Synopsis

Documentation

class Typeable a => Fixture a where Source #

Minimal complete definition

fixtureAction

Methods

fixtureScope :: FixtureScope Source #

The scope of the fixture, defaults to per-test

fixtureAction :: IO (a, FixtureCleanup) Source #

getFixture :: (Fixture a, MonadIO m) => m a Source #

Load a fixture, initializing it if it hasn't been cached already.

Cleanup

data FixtureCleanup Source #

Constructors

NoCleanup 
CleanupFunc (IO ()) 

noCleanup :: a -> (a, FixtureCleanup) Source #

A helper for specifying no cleanup.

withCleanup :: a -> IO () -> (a, FixtureCleanup) Source #

A helper for defining the cleanup function in-line.

cleanupFixtures :: FixtureScopeKey -> IO () Source #

Clean up fixtures in the given scope.

Clean up functions are run in the reverse order the fixtures finished in. For example, if a test asks for fixtures A and C, A asks for B, and C asks for D, the fixtures should finish loading in order: B, A, D, C. Cleanup should then go in order: C, D, A, B.

Built-in fixtures

newtype FixtureTmpDir Source #

A fixture that provides a temporary directory that can be used in a test.

Constructors

FixtureTmpDir FilePath