packages feed

hspec-meta 2.11.4 → 2.11.5

raw patch · 7 files changed

+84/−24 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hspec-core/src/Test/Hspec/Core/Config/Definition.hs view
@@ -81,6 +81,7 @@  , configPrettyPrint :: Bool , configPrettyPrintFunction :: Bool -> String -> String -> (String, String)+, configFormatException :: SomeException -> String -- ^ @since 2.11.5 , configTimes :: Bool , configExpertMode :: Bool -- ^ @since 2.11.2 , configAvailableFormatters :: [(String, FormatConfig -> IO Format)] -- ^ @since 2.9.0@@ -122,6 +123,7 @@ , configExternalDiff = Nothing , configPrettyPrint = True , configPrettyPrintFunction = pretty2+, configFormatException = formatExceptionWith show , configTimes = False , configExpertMode = False , configAvailableFormatters = formatters@@ -178,6 +180,9 @@       ]   , option "diff-command" (argument "CMD" return setDiffCommand) "use an external diff command\nexample: --diff-command=\"git diff\""   , mkFlag "pretty" setPretty "try to pretty-print diff values"+  , mkOptionNoArg "show-exceptions" Nothing setShowException "use `show` when formatting exceptions"+  , mkOptionNoArg "display-exceptions" Nothing setDisplayException "use `displayException` when formatting exceptions"+   , mkFlag "times" setTimes "report times for individual spec items"   , mkOptionNoArg "print-cpu-time" Nothing setPrintCpuTime "include used CPU time in summary"   , printSlowItemsOption@@ -227,6 +232,12 @@      setPretty :: Bool -> Config -> Config     setPretty v config = config {configPrettyPrint = v}++    setShowException :: Config -> Config+    setShowException config = config {configFormatException = formatExceptionWith show}++    setDisplayException :: Config -> Config+    setDisplayException config = config {configFormatException = formatExceptionWith displayException}      setTimes :: Bool -> Config -> Config     setTimes v config = config {configTimes = v}
hspec-core/src/Test/Hspec/Core/Format.hs view
@@ -11,6 +11,7 @@ (   Format , FormatConfig(..)+, defaultFormatConfig , Event(..) , Progress , Path@@ -31,7 +32,7 @@ import           Control.Monad.IO.Class  import           Test.Hspec.Core.Example (Progress, Location(..), FailureReason(..))-import           Test.Hspec.Core.Util (Path)+import           Test.Hspec.Core.Util (Path, formatExceptionWith) import           Test.Hspec.Core.Clock (Seconds(..))  type Format = Event -> IO ()@@ -68,6 +69,7 @@ , formatConfigExternalDiff :: Maybe (String -> String -> IO ()) , formatConfigPrettyPrint :: Bool , formatConfigPrettyPrintFunction :: Maybe (String -> String -> (String, String))+, formatConfigFormatException :: SomeException -> String -- ^ @since 2.11.5 , formatConfigPrintTimes :: Bool , formatConfigHtmlOutput :: Bool , formatConfigPrintCpuTime :: Bool@@ -77,6 +79,26 @@ }  {-# DEPRECATED formatConfigPrettyPrint "Use `formatConfigPrettyPrintFunction` instead" #-}++-- ^ @since 2.11.5+defaultFormatConfig :: FormatConfig+defaultFormatConfig = FormatConfig {+  formatConfigUseColor = False+, formatConfigReportProgress = False+, formatConfigOutputUnicode = False+, formatConfigUseDiff = False+, formatConfigDiffContext = Nothing+, formatConfigExternalDiff = Nothing+, formatConfigPrettyPrint = False+, formatConfigPrettyPrintFunction = Nothing+, formatConfigFormatException = formatExceptionWith show+, formatConfigPrintTimes = False+, formatConfigHtmlOutput = False+, formatConfigPrintCpuTime = False+, formatConfigUsedSeed = 0+, formatConfigExpectedTotalCount = 0+, formatConfigExpertMode = False+}  data Signal = Ok | NotOk SomeException 
hspec-core/src/Test/Hspec/Core/Formatters/Internal.hs view
@@ -10,6 +10,10 @@ , FormatM , formatterToFormat +, getConfig+, getConfigValue+, FormatConfig(..)+ , getSuccessCount , getPendingCount , getFailCount@@ -118,13 +122,13 @@  -- | Return `True` if the user requested colorized diffs, `False` otherwise. useDiff :: FormatM Bool-useDiff = getConfig formatConfigUseDiff+useDiff = getConfigValue formatConfigUseDiff  -- | Do nothing on `--expert`, otherwise run the given action. -- -- @since 2.11.2 unlessExpert :: FormatM () -> FormatM ()-unlessExpert action = getConfig formatConfigExpertMode >>= \ case+unlessExpert action = getConfigValue formatConfigExpertMode >>= \ case   False -> action   True -> return () @@ -133,7 +137,7 @@ -- -- @since 2.10.6 diffContext :: FormatM (Maybe Int)-diffContext = getConfig formatConfigDiffContext+diffContext = getConfigValue formatConfigDiffContext  -- | An action for printing diffs. --@@ -145,11 +149,11 @@ -- -- @since 2.10.6 externalDiffAction :: FormatM (Maybe (String -> String -> IO ()))-externalDiffAction = getConfig formatConfigExternalDiff+externalDiffAction = getConfigValue formatConfigExternalDiff  -- | Return `True` if the user requested pretty diffs, `False` otherwise. prettyPrint :: FormatM Bool-prettyPrint = maybe False (const True) <$> getConfig formatConfigPrettyPrintFunction+prettyPrint = maybe False (const True) <$> getConfigValue formatConfigPrettyPrintFunction {-# DEPRECATED prettyPrint "use `prettyPrintFunction` instead" #-}  -- | Return a function for pretty-printing if the user requested pretty diffs,@@ -157,13 +161,13 @@ -- -- @since 2.10.0 prettyPrintFunction :: FormatM (Maybe (String -> String -> (String, String)))-prettyPrintFunction = getConfig formatConfigPrettyPrintFunction+prettyPrintFunction = getConfigValue formatConfigPrettyPrintFunction  -- | Return `True` if the user requested unicode output, `False` otherwise. -- -- @since 2.9.0 outputUnicode :: FormatM Bool-outputUnicode = getConfig formatConfigOutputUnicode+outputUnicode = getConfigValue formatConfigOutputUnicode  -- | The same as `write`, but adds a newline character. writeLine :: String -> FormatM ()@@ -198,12 +202,17 @@ , stateColor           :: Maybe SGR } -getConfig :: (FormatConfig -> a) -> FormatM a-getConfig f = gets (f . stateConfig)+-- | @since 2.11.5+getConfig :: FormatM FormatConfig+getConfig = gets stateConfig +-- | @since 2.11.5+getConfigValue :: (FormatConfig -> a) -> FormatM a+getConfigValue f = gets (f . stateConfig)+ -- | The random seed that is used for QuickCheck. usedSeed :: FormatM Integer-usedSeed = getConfig formatConfigUsedSeed+usedSeed = getConfigValue formatConfigUsedSeed  -- NOTE: We use an IORef here, so that the state persists when UserInterrupt is -- thrown.@@ -257,11 +266,11 @@ -- -- @since 2.9.0 getExpectedTotalCount :: FormatM Int-getExpectedTotalCount = getConfig formatConfigExpectedTotalCount+getExpectedTotalCount = getConfigValue formatConfigExpectedTotalCount  writeTransient :: String -> FormatM () writeTransient new = do-  reportProgress <- getConfig formatConfigReportProgress+  reportProgress <- getConfigValue formatConfigReportProgress   when reportProgress $ do     write new     liftIO $ IO.hFlush stdout@@ -310,7 +319,7 @@ -- | Set a color, run an action, and finally reset colors. withColor :: SGR -> String -> FormatM a -> FormatM a withColor color cls action = do-  produceHTML <- getConfig formatConfigHtmlOutput+  produceHTML <- getConfigValue formatConfigHtmlOutput   (if produceHTML then htmlSpan cls else withColor_ color) action  htmlSpan :: String -> FormatM a -> FormatM a@@ -323,14 +332,14 @@  setColor :: Maybe SGR -> FormatM () setColor color = do-  useColor <- getConfig formatConfigUseColor+  useColor <- getConfigValue formatConfigUseColor   when useColor $ do     modify (\ state -> state { stateColor = color })  -- | Output given chunk in red. extraChunk :: String -> FormatM () extraChunk s = do-  diff <- getConfig formatConfigUseDiff+  diff <- getConfigValue formatConfigUseDiff   case diff of     True -> extra s     False -> write s@@ -341,7 +350,7 @@ -- | Output given chunk in green. missingChunk :: String -> FormatM () missingChunk s = do-  diff <- getConfig formatConfigUseDiff+  diff <- getConfigValue formatConfigUseDiff   case diff of     True -> missing s     False -> write s
hspec-core/src/Test/Hspec/Core/Formatters/V2.hs view
@@ -33,6 +33,11 @@ , FormatM , formatterToFormat +-- ** Accessing config values+, getConfig+, getConfigValue+, FormatConfig(..)+ -- ** Accessing the runner state , getSuccessCount , getPendingCount@@ -76,7 +81,7 @@  -- ** Helpers , formatLocation-, formatException+, Util.formatException  #ifdef TEST , Chunk(..)@@ -90,7 +95,8 @@ import           System.IO (hFlush, stdout)  import           Data.Char-import           Test.Hspec.Core.Util+import           Test.Hspec.Core.Util hiding (formatException)+import qualified Test.Hspec.Core.Util as Util import           Test.Hspec.Core.Clock import           Test.Hspec.Core.Example (Location(..), Progress) import           Text.Printf@@ -110,6 +116,10 @@   , FormatM   , formatterToFormat +  , getConfig+  , getConfigValue+  , FormatConfig(..)+   , getSuccessCount   , getPendingCount   , getFailCount@@ -341,6 +351,7 @@          Error info e -> do           mapM_ indent info+          formatException <- getConfigValue formatConfigFormatException           withFailColor . indent $ "uncaught exception: " ++ formatException e  
hspec-core/src/Test/Hspec/Core/Runner.hs view
@@ -383,6 +383,7 @@       , formatConfigExternalDiff = if configDiff config then ($ configDiffContext config) <$> configExternalDiff config else Nothing       , formatConfigPrettyPrint = configPrettyPrint config       , formatConfigPrettyPrintFunction = if configPrettyPrint config then Just (configPrettyPrintFunction config outputUnicode) else Nothing+      , formatConfigFormatException = configFormatException config       , formatConfigPrintTimes = configTimes config       , formatConfigHtmlOutput = configHtmlOutput config       , formatConfigPrintCpuTime = configPrintCpuTime config
hspec-core/src/Test/Hspec/Core/Util.hs view
@@ -16,6 +16,7 @@ -- * Working with exceptions , safeTry , formatException+, formatExceptionWith ) where  import           Prelude ()@@ -137,9 +138,13 @@ -- -- @since 2.0.0 formatException :: SomeException -> String-formatException err@(SomeException e) = case fromException err of-  Just ioe -> showType ioe ++ " of type " ++ showIOErrorType ioe ++ "\n" ++ show ioe-  Nothing  -> showType e ++ "\n" ++ show e+formatException = formatExceptionWith show++-- | @since 2.11.5+formatExceptionWith :: (SomeException -> String) -> SomeException -> String+formatExceptionWith showException err@(SomeException e) = case fromException err of+  Just ioe -> showType ioe ++ " of type " ++ showIOErrorType ioe ++ "\n" ++ showException (toException ioe)+  Nothing  -> showType e ++ "\n" ++ showException (SomeException e)   where     showIOErrorType :: IOException -> String     showIOErrorType ioe = case ioe_type ioe of
hspec-meta.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2.+-- This file has been generated from package.yaml by hpack version 0.35.5. -- -- see: https://github.com/sol/hpack  name:           hspec-meta-version:        2.11.4+version:        2.11.5 synopsis:       A version of Hspec which is used to test Hspec itself description:    A stable version of Hspec which is used to test the                 in-development version of Hspec.@@ -13,6 +13,7 @@ stability:      experimental homepage:       https://hspec.github.io/ bug-reports:    https://github.com/hspec/hspec/issues+author:         Simon Hengel <sol@typeful.net> maintainer:     Simon Hengel <sol@typeful.net> copyright:      (c) 2011-2023 Simon Hengel,                 (c) 2011-2012 Trystan Spangler,