Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell98 |
A lightweight wrapper for organizing tests (including QuickCheck tests). 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 TestSuite is a monoid.
- data TestSuite
- module Data.Monoid
- suite :: String -> [TestSuite] -> TestSuite
- useProperty :: Testable prop => String -> prop -> TestSuite
- usePropertyWith :: Testable prop => String -> Args -> prop -> 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
- assertMessage :: String -> Bool -> String -> TestSuite
- assertMessageIO :: String -> IO Message -> TestSuite
- onlyWarnings :: TestSuite -> TestSuite
- rateOnError :: Int -> TestSuite -> TestSuite
- runTestSuite :: Bool -> TestSuite -> IO ()
- runTestSuiteResult :: Bool -> TestSuite -> IO Result
- data Result
- subResults :: Result -> [(String, Result)]
- findSubResult :: String -> Result -> Maybe Result
- justOneSuite :: Result -> Maybe (String, Result)
- allMessages :: Result -> [(String, Message)]
- topMessages :: Result -> [(String, Message)]
- nrOfTests :: Result -> Int
- nrOfErrors :: Result -> Int
- nrOfWarnings :: Result -> Int
- timeInterval :: Result -> Double
- makeSummary :: Result -> String
- printSummary :: Result -> IO ()
- data Message
- message :: String -> Message
- warning :: String -> Message
- messageLines :: Message -> [String]
- data Status
- class HasStatus a where
- isError :: HasStatus a => a -> Bool
- isWarning :: HasStatus a => a -> Bool
- isOk :: HasStatus a => a -> Bool
- data Rating
- class HasRating a where
TestSuite
module Data.Monoid
suite :: String -> [TestSuite] -> TestSuite Source
Construct a (named) test suite containing test cases and other suites
useProperty :: Testable prop => String -> prop -> TestSuite Source
Turn a QuickCheck property into the test suite. The first argument is a label for the property
usePropertyWith :: Testable prop => String -> Args -> prop -> TestSuite Source
Turn a QuickCheck property into the test suite, also providing a test configuration (Args)
assertTrue :: String -> Bool -> TestSuite Source
assertNull :: Show a => String -> [a] -> TestSuite Source
onlyWarnings :: TestSuite -> TestSuite Source
All errors are turned into warnings
rateOnError :: Int -> TestSuite -> TestSuite Source
Running a test suite
runTestSuite :: Bool -> TestSuite -> IO () Source
Test Suite Result
subResults :: Result -> [(String, Result)] Source
allMessages :: Result -> [(String, Message)] Source
topMessages :: Result -> [(String, Message)] Source
nrOfErrors :: Result -> Int Source
nrOfWarnings :: Result -> Int Source
timeInterval :: Result -> Double Source
makeSummary :: Result -> String Source
printSummary :: Result -> IO () Source
Message
messageLines :: Message -> [String] Source