Safe Haskell | None |
---|
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 {
- _wdLock :: RLock
- _timeoutFactor :: Double
- 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 ()
- withWorkingDirectory :: FilePath -> HClTest Trace a -> HClTest Trace a
- timeoutFactor :: Lens' Config Double
- wdLock :: Lens' Config RLock
Documentation
The config is passed in a Reader to the test cases.
Config | |
|
MonadReader Config (HClTest w) |
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.
failTest :: a -> HClTest a bSource
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.
randomParallel :: Int -> [HClTest Trace ()] -> HClTest Trace ()Source
Run a number of tests in parallel, in random order. The first argument is the number of threads to use. Note that if the test cases require different working directories, some of the threads may block.