Modulehspec-core-2.11.18Haskell2010
Test.Hspec.Core.Formatters.V1
Deprecated. Use Test.Hspec.Api.Formatters.V1 instead.
This module contains formatters that can be used with hspecWith.
Contents
Synopsis
- value silent
- value checks
- value specdoc
- value progress
- value failed_examples
- data Formatter
- data FailureReason
- type FormatM
- value formatterToFormat
- value getSuccessCount
- value getPendingCount
- value getFailCount
- value getTotalCount
- data FailureRecord
- value getFailMessages
- value usedSeed
- newtype Seconds
- value getCPUTime
- value getRealTime
- value write
- value writeLine
- value writeTransient
- value withInfoColor
- value withSuccessColor
- value withPendingColor
- value withFailColor
- value useDiff
- value extraChunk
- value missingChunk
- value formatException
- Packagehspec-core-2.11.18
- Exports30
- LanguageHaskell2010
- LicenceMIT
- SourceV1.hs
Formatters
Implementing a custom Formatter
A formatter is a set of actions. Each action is evaluated when a certain situation is encountered during a test run.
Actions live in the FormatM monad. It provides access to the runner state and primitives for appending to the generated report.
Constructors
FormatterheaderFormatter :: FormatM ()exampleGroupStarted :: [String] -> String -> FormatM ()exampleGroupDone :: FormatM ()exampleStarted :: Path -> FormatM ()exampleProgress :: Path -> Progress -> FormatM ()exampleSucceeded :: Path -> String -> FormatM ()exampleFailed :: Path -> String -> FailureReason -> FormatM ()examplePending :: Path -> String -> Maybe String -> FormatM ()failedFormatter :: FormatM ()
Instances1Show
Show FailureReasonDefined in hspec-core-2.11.18 · Test.Hspec.Core.Formatters.V1.Monad
Accessing the runner state
Get the number of successful examples encountered so far.
Get the number of pending examples encountered so far.
Get the number of failed examples encountered so far.
Get the total number of examples encountered so far.
Get the list of accumulated failure messages.
The random seed that is used for QuickCheck.
Instances6Eq, Fractional, Num, Ord, Show, PrintfArg
Eq SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.ClockFractional SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.ClockNum SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.ClockOrd SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.ClockShow SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.ClockPrintfArg SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.Clock
Get the used CPU time since the test run has been started.
Get the passed real time since the test run has been started.
Appending to the generated report
Append some output to the report.
The same as write, but adds a newline character.
Dealing with colors
Set output color to cyan, run given action, and finally restore the default color.
Set output color to green, run given action, and finally restore the default color.
Set output color to yellow, run given action, and finally restore the default color.
Set output color to red, run given action, and finally restore the default color.
Output given chunk in red.
Output given chunk in green.
Helpers
The function formatException converts an exception to a string.
This is different from show. The type of the exception is included, e.g.:
formatException (toException DivideByZero)"ArithException\ndivide by zero"
For IOExceptions the IOErrorType is included, as well.