Safe Haskell | None |
---|---|
Language | GHC2021 |
Skeletest.Internal.Fixtures
Contents
Synopsis
- class Typeable a => Fixture a where
- fixtureScope :: FixtureScope
- fixtureAction :: IO (a, FixtureCleanup)
- data FixtureScope
- data FixtureScopeKey
- getFixture :: (Fixture a, MonadIO m) => m a
- data FixtureCleanup
- = NoCleanup
- | CleanupFunc (IO ())
- noCleanup :: a -> (a, FixtureCleanup)
- withCleanup :: a -> IO () -> (a, FixtureCleanup)
- cleanupFixtures :: FixtureScopeKey -> IO ()
- newtype FixtureTmpDir = FixtureTmpDir FilePath
Documentation
class Typeable a => Fixture a where Source #
Minimal complete definition
Methods
fixtureScope :: FixtureScope Source #
The scope of the fixture, defaults to per-test
fixtureAction :: IO (a, FixtureCleanup) Source #
Instances
Fixture FixtureTmpDir Source # | |
Defined in Skeletest.Internal.Fixtures Methods fixtureScope :: FixtureScope Source # fixtureAction :: IO (FixtureTmpDir, FixtureCleanup) Source # |
data FixtureScope Source #
Constructors
PerTestFixture | |
PerFileFixture | |
PerSessionFixture |
Instances
Show FixtureScope Source # | |
Defined in Skeletest.Internal.Fixtures Methods showsPrec :: Int -> FixtureScope -> ShowS # show :: FixtureScope -> String # showList :: [FixtureScope] -> ShowS # |
data FixtureScopeKey Source #
Instances
Show FixtureScopeKey Source # | |
Defined in Skeletest.Internal.Fixtures Methods showsPrec :: Int -> FixtureScopeKey -> ShowS # show :: FixtureScopeKey -> String # showList :: [FixtureScopeKey] -> ShowS # |
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 |
Instances
Fixture FixtureTmpDir Source # | |
Defined in Skeletest.Internal.Fixtures Methods fixtureScope :: FixtureScope Source # fixtureAction :: IO (FixtureTmpDir, FixtureCleanup) Source # |