packages feed

hspec-core 2.11.1 → 2.11.2

raw patch · 10 files changed

+62/−10 lines, 10 filesdep ~hspec-meta

Dependency ranges changed: hspec-meta

Files

help.txt view
@@ -44,6 +44,7 @@            --[no-]times            report times for individual spec items            --print-cpu-time        include used CPU time in summary   -p[N]    --print-slow-items[=N]  print the N slowest spec items (default: 10)+           --[no-]expert           be less verbose  OPTIONS FOR QUICKCHECK   -a N  --qc-max-success=N  maximum number of successful tests before a
hspec-core.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:             hspec-core-version:          2.11.1+version:          2.11.2 license:          MIT license-file:     LICENSE copyright:        (c) 2011-2023 Simon Hengel,@@ -129,7 +129,7 @@     , filepath     , haskell-lexer     , hspec-expectations ==0.8.3.*-    , hspec-meta ==2.10.5+    , hspec-meta ==2.11.2     , process     , quickcheck-io >=0.2.0     , random
src/Test/Hspec/Core/Config/Definition.hs view
@@ -82,6 +82,7 @@ , configPrettyPrint :: Bool , configPrettyPrintFunction :: Bool -> String -> String -> (String, String) , configTimes :: Bool+, configExpertMode :: Bool -- ^ @since 2.11.2 , configAvailableFormatters :: [(String, FormatConfig -> IO Format)] -- ^ @since 2.9.0 , configFormat :: Maybe (FormatConfig -> IO Format) , configFormatter :: Maybe V1.Formatter@@ -122,6 +123,7 @@ , configPrettyPrint = True , configPrettyPrintFunction = pretty2 , configTimes = False+, configExpertMode = False , configAvailableFormatters = formatters , configFormat = Nothing , configFormatter = Nothing@@ -179,6 +181,7 @@   , mkFlag "times" setTimes "report times for individual spec items"   , mkOptionNoArg "print-cpu-time" Nothing setPrintCpuTime "include used CPU time in summary"   , printSlowItemsOption+  , mkFlag "expert" setExpertMode "be less verbose"      -- undocumented for now, as we probably want to change this to produce a     -- standalone HTML report in the future@@ -229,6 +232,9 @@     setTimes v config = config {configTimes = v}      setPrintCpuTime config = config {configPrintCpuTime = True}++    setExpertMode :: Bool -> Config -> Config+    setExpertMode v config = config {configExpertMode = v}  printSlowItemsOption :: Option Config printSlowItemsOption = Option name (Just 'p') (OptArg "N" arg) "print the N slowest spec items (default: 10)" True
src/Test/Hspec/Core/Format.hs view
@@ -73,6 +73,7 @@ , formatConfigPrintCpuTime :: Bool , formatConfigUsedSeed :: Integer , formatConfigExpectedTotalCount :: Int+, formatConfigExpertMode :: Bool }  {-# DEPRECATED formatConfigPrettyPrint "Use `formatConfigPrettyPrintFunction` instead" #-}
src/Test/Hspec/Core/Formatters/Internal.hs view
@@ -43,6 +43,8 @@ , extraChunk , missingChunk +, unlessExpert+ #ifdef TEST , runFormatM , splitLines@@ -117,6 +119,14 @@ -- | Return `True` if the user requested colorized diffs, `False` otherwise. useDiff :: FormatM Bool useDiff = getConfig formatConfigUseDiff++-- | Do nothing on `--expert`, otherwise run the given action.+--+-- @since 2.11.2+unlessExpert :: FormatM () -> FormatM ()+unlessExpert action = getConfig formatConfigExpertMode >>= \ case+  False -> action+  True -> return ()  -- | -- Return the value of `Test.Hspec.Core.Runner.configDiffContext`.
src/Test/Hspec/Core/Formatters/V2.hs view
@@ -71,6 +71,9 @@ , extraChunk , missingChunk +-- ** expert mode+, unlessExpert+ -- ** Helpers , formatLocation , formatException@@ -139,6 +142,8 @@   , prettyPrintFunction   , extraChunk   , missingChunk++  , unlessExpert   )  import           Test.Hspec.Core.Formatters.Diff@@ -338,10 +343,11 @@           mapM_ indent info           withFailColor . indent $ "uncaught exception: " ++ formatException e -      writeLine "" -      let path_ = (if unicode then ushow else show) (joinPath path)-      writeLine ("  To rerun use: --match " ++ path_)+      unlessExpert $ do+        let path_ = (if unicode then ushow else show) (joinPath path)+        writeLine ""+        writeLine ("  To rerun use: --match " ++ path_)       where         indentation = "       "         indent message = do
src/Test/Hspec/Core/Runner.hs view
@@ -388,6 +388,7 @@       , formatConfigPrintCpuTime = configPrintCpuTime config       , formatConfigUsedSeed = seed       , formatConfigExpectedTotalCount = numberOfItems+      , formatConfigExpertMode = configExpertMode config       }        formatter = fromMaybe (V2.formatterToFormat V2.checks) (configFormat config <|> V1.formatterToFormat <$> configFormatter config)
test/Test/Hspec/Core/Formatters/InternalSpec.hs view
@@ -24,6 +24,7 @@ , formatConfigPrintCpuTime = False , formatConfigUsedSeed = 0 , formatConfigExpectedTotalCount = 0+, formatConfigExpertMode = False }  spec :: Spec
test/Test/Hspec/Core/Formatters/V2Spec.hs view
@@ -36,6 +36,7 @@ , formatConfigPrintCpuTime = False , formatConfigUsedSeed = 0 , formatConfigExpectedTotalCount = 0+, formatConfigExpertMode = False } where     unicode = True @@ -235,9 +236,11 @@           ]      describe "formatterDone" $ do+      let expectedButGot expected actual = ItemDone ([], "") . Item Nothing 0 "" $ Failure Nothing $ ExpectedButGot Nothing expected actual+       it "recovers unicode from ExpectedButGot" $ do         formatter <- formatterToFormat failed_examples formatConfig { formatConfigOutputUnicode = True }-        _ <- formatter .  ItemDone ([], "") . Item Nothing 0 "" $ Failure Nothing $ ExpectedButGot Nothing (show "\955") (show "\956")+        formatter $ expectedButGot (show "\955") (show "\956")         (fmap normalizeSummary . captureLines) (formatter $ Done []) `shouldReturn` [             ""           , "Failures:"@@ -254,10 +257,28 @@           , "1 example, 1 failure"           ] +      context "on --expert" $ do+        it "does not print rerun message" $ do+          formatter <- formatterToFormat failed_examples formatConfig { formatConfigExpertMode = True }+          formatter $ expectedButGot "foo" "bar"+          (fmap normalizeSummary . captureLines) (formatter $ Done []) `shouldReturn` [+              ""+            , "Failures:"+            , ""+            , "  1) "+            , "       expected: foo"+            , "        but got: bar"+            , ""+            , "Randomized with seed 0"+            , ""+            , "Finished in 0.0000 seconds"+            , "1 example, 1 failure"+            ]+       context "when actual/expected contain newlines" $ do         it "adds indentation" $ do           formatter <- formatterToFormat failed_examples formatConfig-          _ <- formatter .  ItemDone ([], "") . Item Nothing 0 "" $ Failure Nothing $ ExpectedButGot Nothing "first\nsecond\nthird" "first\ntwo\nthird"+          formatter $ expectedButGot "first\nsecond\nthird" "first\ntwo\nthird"           (fmap normalizeSummary . captureLines) (formatter $ Done []) `shouldReturn` [               ""             , "Failures:"@@ -281,7 +302,7 @@       context "without failures" $ do         it "shows summary in green if there are no failures" $ do           formatter <- formatterToFormat failed_examples formatConfig-          _ <- formatter .  ItemDone ([], "") . Item Nothing 0 "" $ Success+          formatter . ItemDone ([], "") . Item Nothing 0 "" $ Success           (fmap normalizeSummary . captureLines) (formatter $ Done []) `shouldReturn` [               ""             , "Finished in 0.0000 seconds"@@ -291,7 +312,7 @@       context "with pending examples" $ do         it "shows summary in yellow if there are pending examples" $ do           formatter <- formatterToFormat failed_examples formatConfig-          _ <- formatter .  ItemDone ([], "") . Item Nothing 0 "" $ Pending Nothing Nothing+          formatter . ItemDone ([], "") . Item Nothing 0 "" $ Pending Nothing Nothing           (fmap normalizeSummary . captureLines) (formatter $ Done []) `shouldReturn` [               ""             , "Finished in 0.0000 seconds"
version.yaml view
@@ -1,1 +1,6 @@-&version 2.11.1+version: &version 2.11.2+synopsis: A Testing Framework for Haskell+maintainer: Simon Hengel <sol@typeful.net>+category: Testing+stability: experimental+homepage: https://hspec.github.io/