| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
EasyTest.Internal
- crash :: HasCallStack => Text -> Test a
- note :: Text -> Test ()
- scope :: Text -> Test a -> Test a
- data Status
- data Env = Env {}
- newtype Test a = Test (ReaderT Env IO (Maybe a))
- actionAllowed :: Env -> Bool
- putResult :: Status -> ReaderT Env IO ()
- runWrap :: Env -> ReaderT Env IO (Maybe a) -> IO (Maybe a)
- combineStatus :: Status -> Status -> Status
Core
scope :: Text -> Test a -> Test a Source #
Label a test. Can be nested. A "." is placed between nested
scopes, so scope "foo" . scope "bar" is equivalent to scope "foo.bar"
Internal
Status of a test
Constructors
| Env | |
Instances
Tests are values of type Test a, and Test forms a monad with access to:
- repeatable randomness (the
randomandrandom'functions for random and bounded random values, or handy specializedint,int',double,double', etc) - I/O (via
liftIOorio, which is an alias forliftIO) - failure (via
crash, which yields a stack trace, orfail, which does not) - logging (via
note,noteScoped, ornote') - hierarchically-named subcomputations (under
scope) which can be switched on and off viarunOnly - parallelism (via
fork) - conjunction of tests via
MonadPlus(the<|>operation runs both tests, even if the first test fails, and the tests function used above is justmsum).
Using any or all of these capabilities, you assemble Test values into a "test suite" (just another Test value) using ordinary Haskell code, not framework magic. Notice that to generate a list of random values, we just replicateM and forM as usual.
actionAllowed :: Env -> Bool Source #