Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module defines the basic test type, HClTest, which is a monad. It also provides functions for creating and running tests.
- newtype HClTest w a = HClTest {}
- data Config = Config {}
- runHClTest :: Double -> HClTest Trace () -> IO (Bool, String)
- runHClTestTrace :: Double -> HClTest Trace () -> IO (Bool, DList Trace)
- failTest :: a -> HClTest a b
- testStep :: String -> HClTest String a -> HClTest Trace a
- traceMsg :: a -> HClTest a ()
- testIO :: String -> IO Bool -> HClTest Trace ()
- randomParallel :: Int -> [HClTest Trace ()] -> HClTest Trace ()
- timeoutFactor :: Iso' Config Double
Documentation
The HClTest monad. A HClTest action describes a single test case. The first argument is the type
of the trace entries. For tests, this should be Trace
. For a single test step, this should be String
.
MonadReader Config (HClTest w) Source | |
MonadBase IO (HClTest w) Source | |
MonadBaseControl IO (HClTest w) Source | |
Monad (HClTest w) Source | |
Functor (HClTest w) Source | |
Applicative (HClTest w) Source | |
Alternative (HClTest w) Source | |
MonadPlus (HClTest w) Source | |
MonadIO (HClTest w) Source | |
type StM (HClTest w) a = StM (ReaderT Config (MaybeT (WriterT (DList w) IO))) a Source |
The config is passed in a Reader to the test cases.
runHClTest :: Double -> HClTest Trace () -> IO (Bool, String) Source
Like runHClTestTrace, but already shows the trace so that you get a string.
runHClTestTrace :: Double -> HClTest Trace () -> IO (Bool, DList Trace) Source
Run a HClTest. The first argument is the timeout for waiting for output of the process, in milliseconds. The second argument is the test case.
This will run the test in a temporary working directory. Use the functions in Test.HClTest.Setup to setup the environment.
Returns True when the test succeeded, False otherwise.
failTest :: a -> HClTest a b Source
This is a HClTest action that always fails. The first argument is the trace to leave.
If you want to fail without leaving a trace, you can just use mzero
.
testIO :: String -> IO Bool -> HClTest Trace () Source
Run an IO action, and fail if that action returns false. The first argument is a description of the IO action which will be used for the trace messages.