Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Spec = SpecWith ()
- type SpecWith inner = SpecM inner ()
- type SpecM inner result = TestDefM '[] inner result
- type TestDef outers inner = TestDefM outers inner ()
- newtype TestDefM (outers :: [Type]) inner result = TestDefM {
- unTestDefM :: WriterT (TestForest outers inner) (ReaderT TestDefEnv IO) result
- data TestDefEnv = TestDefEnv {}
- execTestDefM :: Settings -> TestDefM outers inner result -> IO (TestForest outers inner)
- runTestDefM :: Settings -> TestDefM outers inner result -> IO (result, TestForest outers inner)
- getTestDescriptionPath :: TestDefM outers inner [Text]
- toTestRunSettings :: Settings -> TestRunSettings
Documentation
newtype TestDefM (outers :: [Type]) inner result Source #
The test definition monad
This type has three parameters:
outers
: A type-level list of the outer resources. These are resources that are prived once, around a group of tests. (This is the type of the results ofaroundAll
.)inner
: The inner resource. This is a resource that is set up around every test, and even every example of a property test. (This is the type of the result ofaround
.)result
: The result (TestDefM
is a monad.)
In practice, all of these three parameters should be ()
at the top level.
TestDefM | |
|
Instances
MonadReader TestDefEnv (TestDefM outers inner) Source # | |
Defined in Test.Syd.Def.TestDefM ask :: TestDefM outers inner TestDefEnv # local :: (TestDefEnv -> TestDefEnv) -> TestDefM outers inner a -> TestDefM outers inner a # reader :: (TestDefEnv -> a) -> TestDefM outers inner a # | |
Monad (TestDefM outers inner) Source # | |
Functor (TestDefM outers inner) Source # | |
Applicative (TestDefM outers inner) Source # | |
Defined in Test.Syd.Def.TestDefM pure :: a -> TestDefM outers inner a # (<*>) :: TestDefM outers inner (a -> b) -> TestDefM outers inner a -> TestDefM outers inner b # liftA2 :: (a -> b -> c) -> TestDefM outers inner a -> TestDefM outers inner b -> TestDefM outers inner c # (*>) :: TestDefM outers inner a -> TestDefM outers inner b -> TestDefM outers inner b # (<*) :: TestDefM outers inner a -> TestDefM outers inner b -> TestDefM outers inner a # | |
MonadIO (TestDefM outers inner) Source # | |
Defined in Test.Syd.Def.TestDefM | |
MonadWriter (TestForest outers inner) (TestDefM outers inner) Source # | |
Defined in Test.Syd.Def.TestDefM writer :: (a, TestForest outers inner) -> TestDefM outers inner a # tell :: TestForest outers inner -> TestDefM outers inner () # listen :: TestDefM outers inner a -> TestDefM outers inner (a, TestForest outers inner) # pass :: TestDefM outers inner (a, TestForest outers inner -> TestForest outers inner) -> TestDefM outers inner a # |
data TestDefEnv Source #
Instances
execTestDefM :: Settings -> TestDefM outers inner result -> IO (TestForest outers inner) Source #
runTestDefM :: Settings -> TestDefM outers inner result -> IO (result, TestForest outers inner) Source #
getTestDescriptionPath :: TestDefM outers inner [Text] Source #
Get the path of describe
strings upwards.
Note that using this function makes tests less movable, depending on what
you do with these strings.
For example, if you use these strings to define the path to a golden test
file, then that path will change if you move the tests somewhere else.
This combines unfortunately with the way sydtest-discover
makes the module
name part of this path.
Indeed: moving your tests to another module will change their path as well,
if you use sydtest-discover
.
Also note that while test forests can be randomised, their description path
upwards will not, because of how trees are structured.