Portability | portable (depends on ghc) |
---|---|
Stability | provisional |
Maintainer | bastiaan.heeren@ou.nl |
Safe Haskell | None |
A lightweight wrapper around the QuickCheck library. It introduces the notion of a test suite, and it stores the test results for later inspection (e.g., for the generation of a test report). A test suite has a monadic interface.
- type TestSuite = TestSuiteM ()
- class Monad m => MonadIO m where
- suite :: String -> TestSuite -> TestSuite
- addProperty :: Testable prop => String -> prop -> TestSuite
- addPropertyWith :: Testable prop => String -> Args -> prop -> TestSuite
- warn :: String -> TestSuite
- assertTrue :: String -> Bool -> TestSuite
- assertNull :: Show a => String -> [a] -> TestSuite
- assertEquals :: (Eq a, Show a) => String -> a -> a -> TestSuite
- assertIO :: String -> IO Bool -> TestSuite
- runTestSuite :: TestSuite -> IO ()
- runTestSuiteResult :: TestSuite -> IO TestSuiteResult
- data TestSuiteResult
- subResults :: TestSuiteResult -> [(String, TestSuiteResult)]
- findSubResult :: String -> TestSuiteResult -> Maybe TestSuiteResult
- messages :: TestSuiteResult -> [Message]
- topMessages :: TestSuiteResult -> [Message]
- numberOfTests :: TestSuiteResult -> Int
- makeSummary :: TestSuiteResult -> String
- printSummary :: TestSuiteResult -> IO ()
- data Message
- newMessage :: String -> Message
- isError :: Message -> Bool
- warning :: Message -> Message
- messageLabel :: Message -> Maybe String
Test Suite Monad
class Monad m => MonadIO m where
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
MonadIO IO | |
MonadIO m => MonadIO (CGIT m) | |
MonadIO m => MonadIO (ListT m) | |
MonadIO m => MonadIO (MaybeT m) | |
MonadIO m => MonadIO (IdentityT m) | |
MonadIO m => MonadIO (ContT r m) | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
MonadIO m => MonadIO (ReaderT r m) | |
MonadIO m => MonadIO (StateT s m) | |
MonadIO m => MonadIO (StateT s m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
MonadIO m => MonadIO (ParsecT s u m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) |
Test suite constructors
suite :: String -> TestSuite -> TestSuiteSource
Construct a (named) test suite containing tests and other suites
addProperty :: Testable prop => String -> prop -> TestSuiteSource
Add a QuickCheck property to the test suite. The first argument is a label for the property
addPropertyWith :: Testable prop => String -> Args -> prop -> TestSuiteSource
Add a QuickCheck property to the test suite, also providing a test configuration (Args)
assertTrue :: String -> Bool -> TestSuiteSource
assertNull :: Show a => String -> [a] -> TestSuiteSource
Running a test suite
runTestSuite :: TestSuite -> IO ()Source
Test Suite Result
subResults :: TestSuiteResult -> [(String, TestSuiteResult)]Source
messages :: TestSuiteResult -> [Message]Source
topMessages :: TestSuiteResult -> [Message]Source
printSummary :: TestSuiteResult -> IO ()Source
Messages
newMessage :: String -> MessageSource
messageLabel :: Message -> Maybe StringSource