-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Testing Framework for Haskell -- -- This package provides a stable API that can be used to extend Hspec's -- functionality. @package hspec-api @version 2.8.0 module Test.Hspec.Api.Format.V1 type Format = Event -> IO () data FormatConfig FormatConfig :: Bool -> Bool -> Bool -> Bool -> Bool -> Integer -> Int -> FormatConfig [formatConfigUseColor] :: FormatConfig -> Bool [formatConfigUseDiff] :: FormatConfig -> Bool [formatConfigPrintTimes] :: FormatConfig -> Bool [formatConfigHtmlOutput] :: FormatConfig -> Bool [formatConfigPrintCpuTime] :: FormatConfig -> Bool [formatConfigUsedSeed] :: FormatConfig -> Integer [formatConfigExpectedTotalCount] :: FormatConfig -> Int data Event Started :: Event GroupStarted :: Path -> Event GroupDone :: Path -> Event Progress :: Path -> Progress -> Event ItemStarted :: Path -> Event ItemDone :: Path -> Item -> Event Done :: [(Path, Item)] -> Event type Progress = (Int, Int) -- | A Path describes the location of a spec item within a spec -- tree. -- -- It consists of a list of group descriptions and a requirement -- description. type Path = ([String], String) -- | Location is used to represent source locations. data Location Location :: FilePath -> Int -> Int -> Location [locationFile] :: Location -> FilePath [locationLine] :: Location -> Int [locationColumn] :: Location -> Int newtype Seconds Seconds :: Double -> Seconds data Item Item :: Maybe Location -> Seconds -> String -> Result -> Item [itemLocation] :: Item -> Maybe Location [itemDuration] :: Item -> Seconds [itemInfo] :: Item -> String [itemResult] :: Item -> Result data Result Success :: Result Pending :: Maybe Location -> Maybe String -> Result Failure :: Maybe Location -> FailureReason -> Result data FailureReason NoReason :: FailureReason Reason :: String -> FailureReason ExpectedButGot :: Maybe String -> String -> String -> FailureReason Error :: Maybe String -> SomeException -> FailureReason monadic :: MonadIO m => (m () -> IO ()) -> (Event -> m ()) -> IO Format -- | Make a formatter available for use with --format and use it -- by default. useFormatter :: (String, FormatConfig -> IO Format) -> Config -> Config -- | Make a formatter compatible with types from -- Test.Hspec.Core.Format. liftFormatter :: (String, FormatConfig -> IO Format) -> (String, FormatConfig -> IO Format) data Config -- | This module contains formatters that can be used with -- hspecWith: -- --
-- import Test.Hspec
-- import Test.Hspec.Api.Formatters.V1
--
-- main :: IO ()
-- main = hspecWith (useFormatter ("my-formatter", formatter) defaultConfig) spec
--
-- formatter :: Formatter
-- formatter = ...
--
-- spec :: Spec
-- spec = ...
--
module Test.Hspec.Api.Formatters.V1
-- | Make a formatter available for use with --format and use it
-- by default.
useFormatter :: (String, Formatter) -> Config -> Config
formatterToFormat :: Formatter -> FormatConfig -> IO Format
silent :: Formatter
checks :: Formatter
specdoc :: Formatter
progress :: Formatter
failed_examples :: Formatter
data Formatter
Formatter :: FormatM () -> ([String] -> String -> FormatM ()) -> FormatM () -> (Path -> FormatM ()) -> (Path -> Progress -> FormatM ()) -> (Path -> String -> FormatM ()) -> (Path -> String -> FailureReason -> FormatM ()) -> (Path -> String -> Maybe String -> FormatM ()) -> FormatM () -> FormatM () -> Formatter
[headerFormatter] :: Formatter -> FormatM ()
[exampleGroupStarted] :: Formatter -> [String] -> String -> FormatM ()
[exampleGroupDone] :: Formatter -> FormatM ()
[exampleStarted] :: Formatter -> Path -> FormatM ()
[exampleProgress] :: Formatter -> Path -> Progress -> FormatM ()
[exampleSucceeded] :: Formatter -> Path -> String -> FormatM ()
[exampleFailed] :: Formatter -> Path -> String -> FailureReason -> FormatM ()
[examplePending] :: Formatter -> Path -> String -> Maybe String -> FormatM ()
[failedFormatter] :: Formatter -> FormatM ()
[footerFormatter] :: Formatter -> FormatM ()
data FailureReason
NoReason :: FailureReason
Reason :: String -> FailureReason
ExpectedButGot :: Maybe String -> String -> String -> FailureReason
Error :: Maybe String -> SomeException -> FailureReason
type FormatM = Free FormatF
-- | Get the number of successful examples encountered so far.
getSuccessCount :: FormatM Int
-- | Get the number of pending examples encountered so far.
getPendingCount :: FormatM Int
-- | Get the number of failed examples encountered so far.
getFailCount :: FormatM Int
-- | Get the total number of examples encountered so far.
getTotalCount :: FormatM Int
data FailureRecord
FailureRecord :: Maybe Location -> Path -> FailureReason -> FailureRecord
[failureRecordLocation] :: FailureRecord -> Maybe Location
[failureRecordPath] :: FailureRecord -> Path
[failureRecordMessage] :: FailureRecord -> FailureReason
-- | Get the list of accumulated failure messages.
getFailMessages :: FormatM [FailureRecord]
-- | The random seed that is used for QuickCheck.
usedSeed :: FormatM Integer
newtype Seconds
Seconds :: Double -> Seconds
-- | Get the used CPU time since the test run has been started.
getCPUTime :: FormatM (Maybe Seconds)
-- | Get the passed real time since the test run has been started.
getRealTime :: FormatM Seconds
-- | Append some output to the report.
write :: String -> FormatM ()
-- | The same as write, but adds a newline character.
writeLine :: String -> FormatM ()
writeTransient :: String -> FormatM ()
-- | Set output color to cyan, run given action, and finally restore the
-- default color.
withInfoColor :: FormatM a -> FormatM a
-- | Set output color to green, run given action, and finally restore the
-- default color.
withSuccessColor :: FormatM a -> FormatM a
-- | Set output color to yellow, run given action, and finally restore the
-- default color.
withPendingColor :: FormatM a -> FormatM a
-- | Set output color to red, run given action, and finally restore the
-- default color.
withFailColor :: FormatM a -> FormatM a
-- | Return True if the user requested colorized diffs, False
-- otherwise.
useDiff :: FormatM Bool
-- | Output given chunk in red.
extraChunk :: String -> FormatM ()
-- | Output given chunk in green.
missingChunk :: String -> FormatM ()
-- | 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. formatException :: SomeException -> String -- | Location is used to represent source locations. data Location Location :: FilePath -> Int -> Int -> Location [locationFile] :: Location -> FilePath [locationLine] :: Location -> Int [locationColumn] :: Location -> Int type Progress = (Int, Int) data Config -- | This module contains formatters that can be used with -- hspecWith: -- --
-- import Test.Hspec
-- import Test.Hspec.Api.Formatters.V1
--
-- main :: IO ()
-- main = hspecWith (useFormatter ("my-formatter", formatter) defaultConfig) spec
--
-- formatter :: Formatter
-- formatter = ...
--
-- spec :: Spec
-- spec = ...
--
module Test.Hspec.Api.Formatters.V2
-- | Make a formatter available for use with --format and use it
-- by default.
useFormatter :: (String, Formatter) -> Config -> Config
formatterToFormat :: Formatter -> FormatConfig -> IO Format
silent :: Formatter
checks :: Formatter
specdoc :: Formatter
progress :: Formatter
failed_examples :: Formatter
data Formatter
Formatter :: FormatM () -> (Path -> FormatM ()) -> (Path -> FormatM ()) -> (Path -> Progress -> FormatM ()) -> (Path -> FormatM ()) -> (Path -> Item -> FormatM ()) -> FormatM () -> Formatter
[formatterStarted] :: Formatter -> FormatM ()
[formatterGroupStarted] :: Formatter -> Path -> FormatM ()
[formatterGroupDone] :: Formatter -> Path -> FormatM ()
[formatterProgress] :: Formatter -> Path -> Progress -> FormatM ()
[formatterItemStarted] :: Formatter -> Path -> FormatM ()
[formatterItemDone] :: Formatter -> Path -> Item -> FormatM ()
[formatterDone] :: Formatter -> FormatM ()
-- | A Path describes the location of a spec item within a spec
-- tree.
--
-- It consists of a list of group descriptions and a requirement
-- description.
type Path = ([String], String)
type Progress = (Int, Int)
-- | Location is used to represent source locations.
data Location
Location :: FilePath -> Int -> Int -> Location
[locationFile] :: Location -> FilePath
[locationLine] :: Location -> Int
[locationColumn] :: Location -> Int
data Item
Item :: Maybe Location -> Seconds -> String -> Result -> Item
[itemLocation] :: Item -> Maybe Location
[itemDuration] :: Item -> Seconds
[itemInfo] :: Item -> String
[itemResult] :: Item -> Result
data Result
Success :: Result
Pending :: Maybe Location -> Maybe String -> Result
Failure :: Maybe Location -> FailureReason -> Result
data FailureReason
NoReason :: FailureReason
Reason :: String -> FailureReason
ExpectedButGot :: Maybe String -> String -> String -> FailureReason
Error :: Maybe String -> SomeException -> FailureReason
data FormatM a
-- | Get the number of successful examples encountered so far.
getSuccessCount :: FormatM Int
-- | Get the number of pending examples encountered so far.
getPendingCount :: FormatM Int
-- | Get the number of failed examples encountered so far.
getFailCount :: FormatM Int
-- | Get the total number of examples encountered so far.
getTotalCount :: FormatM Int
data FailureRecord
FailureRecord :: Maybe Location -> Path -> FailureReason -> FailureRecord
[failureRecordLocation] :: FailureRecord -> Maybe Location
[failureRecordPath] :: FailureRecord -> Path
[failureRecordMessage] :: FailureRecord -> FailureReason
-- | Get the list of accumulated failure messages.
getFailMessages :: FormatM [FailureRecord]
-- | The random seed that is used for QuickCheck.
usedSeed :: FormatM Integer
-- | Return True if the user requested time reporting for individual
-- spec items, False otherwise.
printTimes :: FormatM Bool
newtype Seconds
Seconds :: Double -> Seconds
-- | Get the used CPU time since the test run has been started.
getCPUTime :: FormatM (Maybe Seconds)
-- | Get the passed real time since the test run has been started.
getRealTime :: FormatM Seconds
-- | Append some output to the report.
write :: String -> FormatM ()
-- | The same as write, but adds a newline character.
writeLine :: String -> FormatM ()
writeTransient :: String -> FormatM ()
-- | Set output color to cyan, run given action, and finally restore the
-- default color.
withInfoColor :: FormatM a -> FormatM a
-- | Set output color to green, run given action, and finally restore the
-- default color.
withSuccessColor :: FormatM a -> FormatM a
-- | Set output color to yellow, run given action, and finally restore the
-- default color.
withPendingColor :: FormatM a -> FormatM a
-- | Set output color to red, run given action, and finally restore the
-- default color.
withFailColor :: FormatM a -> FormatM a
-- | Return True if the user requested colorized diffs, False
-- otherwise.
useDiff :: FormatM Bool
-- | Return the value of configDiffContext.
diffContext :: FormatM (Maybe Int)
-- | An action for printing diffs.
--
-- The action takes expected and actual as arguments.
--
-- When this is a Just-value then it should be used instead of any
-- built-in diff implementation. A Just-value also implies that
-- useDiff returns True.
externalDiffAction :: FormatM (Maybe (String -> String -> IO ()))
-- | Return True if the user requested pretty diffs, False
-- otherwise.
prettyPrint :: FormatM Bool
-- | Output given chunk in red.
extraChunk :: String -> FormatM ()
-- | Output given chunk in green.
missingChunk :: String -> FormatM ()
formatLocation :: Location -> String
-- | 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. formatException :: SomeException -> String data Config