packages feed

hspec-meta 1.6.1 → 1.6.2

raw patch · 6 files changed

+39/−7 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Test.Hspec.Meta: before :: IO () -> Spec -> Spec

Files

hspec-meta.cabal view
@@ -1,5 +1,5 @@ name:             hspec-meta-version:          1.6.1+version:          1.6.2 license:          MIT license-file:     LICENSE copyright:        (c) 2011-2013 Simon Hengel,
src/Test/Hspec.hs view
@@ -32,6 +32,7 @@ , example , pending , pendingWith+, before , parallel  -- * Running a spec@@ -145,9 +146,16 @@  -- | Run examples of given spec in parallel. parallel :: Spec -> Spec-parallel = fromSpecList . map go . runSpecM+parallel = mapSpecItem $ \_ r e -> SpecItem True r e++-- | Run a custom action before every spec item.+before :: IO () -> Spec -> Spec+before action = mapSpecItem $ \b r e -> SpecItem b r (\params -> (action >> (e params)))++mapSpecItem :: (Bool -> String -> (Params -> IO Result) -> SpecTree) -> Spec -> Spec+mapSpecItem f = fromSpecList . map go . runSpecM   where     go :: SpecTree -> SpecTree     go spec = case spec of-      SpecItem _ r e -> SpecItem True r e+      SpecItem b r e -> f b r e       SpecGroup d es -> SpecGroup d (map go es)
src/Test/Hspec/Config.hs view
@@ -68,15 +68,25 @@   , configHandle          = maybe (configHandle defaultConfig) Right (optionsOutputFile opts)   }   where-    qcArgs = maybe id setSeed mSeed args-      where-        args = maybe id setMaxSuccess mMaxSuccess QC.stdArgs+    qcArgs = (+        maybe id setSeed mSeed+      . maybe id setMaxDiscardRatio mMaxDiscardRatio+      . maybe id setMaxSize mMaxSize+      . maybe id setMaxSuccess mMaxSuccess) QC.stdArgs      mSeed = optionsSeed opts <|> (failureReportSeed <$> mFailureReport)     mMaxSuccess = optionsMaxSuccess opts <|> (failureReportMaxSuccess <$> mFailureReport)+    mMaxSize = optionsMaxSize opts <|> (failureReportMaxSize <$> mFailureReport)+    mMaxDiscardRatio = optionsMaxDiscardRatio opts <|> (failureReportMaxDiscardRatio <$> mFailureReport)      setMaxSuccess :: Int -> QC.Args -> QC.Args     setMaxSuccess n args = args {QC.maxSuccess = n}++    setMaxSize :: Int -> QC.Args -> QC.Args+    setMaxSize n args = args {QC.maxSize = n}++    setMaxDiscardRatio :: Int -> QC.Args -> QC.Args+    setMaxDiscardRatio n args = args {QC.maxDiscardRatio = n}      setSeed :: Integer -> QC.Args -> QC.Args     setSeed n args = args {QC.replay = Just (stdGenFromInteger n, 0)}
src/Test/Hspec/FailureReport.hs view
@@ -11,6 +11,8 @@ data FailureReport = FailureReport {   failureReportSeed :: Integer , failureReportMaxSuccess :: Int+, failureReportMaxSize :: Int+, failureReportMaxDiscardRatio :: Int , failureReportPaths :: [Path] } deriving (Eq, Show, Read) 
src/Test/Hspec/Options.hs view
@@ -26,6 +26,8 @@ , optionsMatch        :: [String] , optionsMaxSuccess   :: Maybe Int , optionsSeed         :: Maybe Integer+, optionsMaxSize      :: Maybe Int+, optionsMaxDiscardRatio :: Maybe Int , optionsColorMode    :: ColorMode , optionsFormatter    :: Formatter , optionsHtmlOutput   :: Bool@@ -38,6 +40,12 @@ setMaxSuccess :: Int -> Options -> Options setMaxSuccess n c = c {optionsMaxSuccess = Just n} +setMaxSize :: Int -> Options -> Options+setMaxSize n c = c {optionsMaxSize = Just n}++setMaxDiscardRatio :: Int -> Options -> Options+setMaxDiscardRatio n c = c {optionsMaxDiscardRatio = Just n}+ setSeed :: Integer -> Options -> Options setSeed n c = c {optionsSeed = Just n} @@ -45,7 +53,7 @@   deriving (Eq, Show)  defaultOptions :: Options-defaultOptions = Options False False False False [] Nothing Nothing ColorAuto specdoc False Nothing+defaultOptions = Options False False False False [] Nothing Nothing Nothing Nothing ColorAuto specdoc False Nothing  formatters :: [(String, Formatter)] formatters = [@@ -88,6 +96,8 @@   , mkOption "f"  "format"            (Arg "FORMATTER" readFormatter setFormatter) formatHelp   , mkOption "o"  "out"               (Arg "FILE" return setOutputFile)   (h "write output to a file instead of STDOUT")   , mkOption "a"  "qc-max-success"    (Arg "N" readMaybe setMaxSuccess)   (h "maximum number of successful tests before a QuickCheck property succeeds")+  , mkOption ""   "qc-max-size"       (Arg "N" readMaybe setMaxSize)      (h "size to use for the biggest test cases")+  , mkOption ""   "qc-max-discard"    (Arg "N" readMaybe setMaxDiscardRatio) (h "maximum number of discarded tests per successful test before giving up")   , mkOption []   "seed"              (Arg "N" readMaybe setSeed)         (h "used seed for QuickCheck properties")   , Option   []  ["print-cpu-time"]   (NoArg setPrintCpuTime)             (h "include used CPU time in summary")   , Option   []  ["dry-run"]          (NoArg setDryRun)                   (h "pretend that everything passed; don't verify anything")
src/Test/Hspec/Runner.hs view
@@ -125,6 +125,8 @@       liftIO $ writeFailureReport FailureReport {           failureReportSeed = seed         , failureReportMaxSuccess = QC.maxSuccess (configQuickCheckArgs c)+        , failureReportMaxSize = QC.maxSize (configQuickCheckArgs c)+        , failureReportMaxDiscardRatio = QC.maxDiscardRatio (configQuickCheckArgs c)         , failureReportPaths = xs         }