hspec-core-2.11.16: A Testing Framework for Haskell

Stability | unstable
Safe Haskell | None
Language | Haskell2010

Test.Hspec.Core.Format

Description

This is an unstable API. Use Test.Hspec.Api.Format.V2 instead.

Synopsis

- type Format = Event -> IO ()
- data FormatConfig = FormatConfig {
  - formatConfigUseColor :: Bool
  - formatConfigReportProgress :: Bool
  - formatConfigOutputUnicode :: Bool
  - formatConfigUseDiff :: Bool
  - formatConfigDiffContext :: Maybe Int
  - formatConfigExternalDiff :: Maybe (String -> String -> IO ())
  - formatConfigPrettyPrint :: Bool
  - formatConfigPrettyPrintFunction :: Maybe (String -> String -> (String, String))
  - formatConfigFormatException :: SomeException -> String
  - formatConfigPrintTimes :: Bool
  - formatConfigHtmlOutput :: Bool
  - formatConfigPrintCpuTime :: Bool
  - formatConfigUsedSeed :: Integer
  - formatConfigExpectedTotalCount :: Int
  - formatConfigExpertMode :: Bool
  }
- defaultFormatConfig :: FormatConfig
- data Event
  - = Started
  - | GroupStarted Path
  - | GroupDone Path
  - | Progress Path Progress
  - | ItemStarted Path
  - | ItemDone Path Item
  - | Done [(Path, Item)]
- type Progress = (Int, Int)
- type Path = ([String], String)
- data Location = Location {
  - locationFile :: FilePath
  - locationLine :: Int
  - locationColumn :: Int
  }
- newtype Seconds = Seconds Double
- data Item = Item {
  - itemLocation :: Maybe Location
  - itemDuration :: Seconds
  - itemInfo :: String
  - itemResult :: Result
  }
- data Result
  - = Success
  - | Pending (Maybe Location) (Maybe String)
  - | Failure (Maybe Location) FailureReason
- data FailureReason
  - = NoReason
  - | Reason String
  - | ColorizedReason String
  - | ExpectedButGot (Maybe String) String String
  - | Error (Maybe String) SomeException
- monadic :: MonadIO m => (m () -> IO ()) -> (Event -> m ()) -> IO Format

# Documentation

type Format = Event -> IO () Source #

data FormatConfig Source #

Since: 2.11.5

Constructors

FormatConfig |

Fields

- formatConfigUseColor :: Bool
- formatConfigReportProgress :: Bool
- formatConfigOutputUnicode :: Bool
- formatConfigUseDiff :: Bool
- formatConfigDiffContext :: Maybe Int
- formatConfigExternalDiff :: Maybe (String -> String -> IO ())
- formatConfigPrettyPrint :: Bool

  Deprecated: Use `formatConfigPrettyPrintFunction` instead

- formatConfigPrettyPrintFunction :: Maybe (String -> String -> (String, String))
- formatConfigFormatException :: SomeException -> String

  Since: 2.11.5

- formatConfigPrintTimes :: Bool
- formatConfigHtmlOutput :: Bool
- formatConfigPrintCpuTime :: Bool
- formatConfigUsedSeed :: Integer
- formatConfigExpectedTotalCount :: Int
- formatConfigExpertMode :: Bool

defaultFormatConfig :: FormatConfig Source #

data Event Source #

Constructors

Started |
GroupStarted Path |
GroupDone Path |
Progress Path Progress |
ItemStarted Path |
ItemDone Path Item |
Done [(Path, Item)] |

#### Instances

Instances details

Show Event Source # |
Instance details Defined in Test.Hspec.Core.Format Methods showsPrec :: Int -> Event -> ShowS Source # show :: Event -> String Source # showList :: [Event] -> ShowS Source #

type Progress = (Int, Int) Source #

`(CurrentItem, TotalItems)` tuple.

type Path = ([String], String) Source #

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.

Since: 2.0.0

data Location Source #

`Location` is used to represent source locations.

Constructors

Location |

Fields

- locationFile :: FilePath
- locationLine :: Int
- locationColumn :: Int

#### Instances

Instances details

Read Location Source # |
Instance details Defined in Test.Hspec.Core.Example.Location Methods readsPrec :: Int -> ReadS Location Source # readList :: ReadS [Location] Source # readPrec :: ReadPrec Location Source # readListPrec :: ReadPrec [Location] Source #
Show Location Source # |
Instance details Defined in Test.Hspec.Core.Example.Location Methods showsPrec :: Int -> Location -> ShowS Source # show :: Location -> String Source # showList :: [Location] -> ShowS Source #
Eq Location Source # |
Instance details Defined in Test.Hspec.Core.Example.Location Methods (==) :: Location -> Location -> Bool Source # (/=) :: Location -> Location -> Bool Source #

newtype Seconds Source #

Constructors

Seconds Double |

#### Instances

Instances details

PrintfArg Seconds Source # |
Instance details Defined in Test.Hspec.Core.Clock Methods formatArg :: Seconds -> FieldFormatter Source # parseFormat :: Seconds -> ModifierParser Source #
Num Seconds Source # |
Instance details Defined in Test.Hspec.Core.Clock Methods (+) :: Seconds -> Seconds -> Seconds Source # (-) :: Seconds -> Seconds -> Seconds Source # (*) :: Seconds -> Seconds -> Seconds Source # negate :: Seconds -> Seconds Source # abs :: Seconds -> Seconds Source # signum :: Seconds -> Seconds Source # fromInteger :: Integer -> Seconds Source #
Fractional Seconds Source # |
Instance details Defined in Test.Hspec.Core.Clock Methods (/) :: Seconds -> Seconds -> Seconds Source # recip :: Seconds -> Seconds Source # fromRational :: Rational -> Seconds Source #
Show Seconds Source # |
Instance details Defined in Test.Hspec.Core.Clock Methods showsPrec :: Int -> Seconds -> ShowS Source # show :: Seconds -> String Source # showList :: [Seconds] -> ShowS Source #
Eq Seconds Source # |
Instance details Defined in Test.Hspec.Core.Clock Methods (==) :: Seconds -> Seconds -> Bool Source # (/=) :: Seconds -> Seconds -> Bool Source #
Ord Seconds Source # |
Instance details Defined in Test.Hspec.Core.Clock Methods compare :: Seconds -> Seconds -> Ordering Source # (<) :: Seconds -> Seconds -> Bool Source # (<=) :: Seconds -> Seconds -> Bool Source # (>) :: Seconds -> Seconds -> Bool Source # (>=) :: Seconds -> Seconds -> Bool Source # max :: Seconds -> Seconds -> Seconds Source # min :: Seconds -> Seconds -> Seconds Source #

data Item Source #

Constructors

Item |

Fields

- itemLocation :: Maybe Location
- itemDuration :: Seconds
- itemInfo :: String
- itemResult :: Result

#### Instances

Instances details

Show Item Source # |
Instance details Defined in Test.Hspec.Core.Format Methods showsPrec :: Int -> Item -> ShowS Source # show :: Item -> String Source # showList :: [Item] -> ShowS Source #

data Result Source #

Constructors

Success |
Pending (Maybe Location) (Maybe String) |
Failure (Maybe Location) FailureReason |

#### Instances

Instances details

Show Result Source # |
Instance details Defined in Test.Hspec.Core.Format Methods showsPrec :: Int -> Result -> ShowS Source # show :: Result -> String Source # showList :: [Result] -> ShowS Source #

data FailureReason Source #

Constructors

NoReason |
Reason String |
ColorizedReason String |
ExpectedButGot (Maybe String) String String |
Error (Maybe String) SomeException |

#### Instances

Instances details

NFData FailureReason Source # |
Instance details Defined in Test.Hspec.Core.Example Methods rnf :: FailureReason -> () Source #
Show FailureReason Source # |
Instance details Defined in Test.Hspec.Core.Example Methods showsPrec :: Int -> FailureReason -> ShowS Source # show :: FailureReason -> String Source # showList :: [FailureReason] -> ShowS Source #

monadic :: MonadIO m => (m () -> IO ()) -> (Event -> m ()) -> IO Format Source #