packages feed

hspec 1.6.2 → 1.7.0

raw patch · 7 files changed

+20/−7 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Test.Hspec.Core: paramsSmallCheckDepth :: Params -> Int
+ Test.Hspec.Runner: configSmallCheckDepth :: Config -> Int
- Test.Hspec.Core: Params :: Args -> (Progress -> IO ()) -> Params
+ Test.Hspec.Core: Params :: Args -> Int -> (Progress -> IO ()) -> Params
- Test.Hspec.Runner: Config :: Bool -> Bool -> Bool -> Maybe (Path -> Bool) -> Args -> ColorMode -> Formatter -> Bool -> Either Handle FilePath -> Config
+ Test.Hspec.Runner: Config :: Bool -> Bool -> Bool -> Maybe (Path -> Bool) -> Args -> Int -> ColorMode -> Formatter -> Bool -> Either Handle FilePath -> Config

Files

hspec.cabal view
@@ -1,5 +1,5 @@ name:             hspec-version:          1.6.2+version:          1.7.0 license:          MIT license-file:     LICENSE copyright:        (c) 2011-2013 Simon Hengel,
src/Test/Hspec/Config.hs view
@@ -8,6 +8,7 @@  import           Control.Applicative import           Data.List+import           Data.Maybe import           System.IO import           System.Exit import qualified Test.QuickCheck as QC@@ -31,6 +32,7 @@ -- that satisfy the predicate are run. , configFilterPredicate :: Maybe (Path -> Bool) , configQuickCheckArgs  :: QC.Args+, configSmallCheckDepth :: Int , configColorMode       :: ColorMode , configFormatter       :: Formatter , configHtmlOutput      :: Bool@@ -38,7 +40,7 @@ }  defaultConfig :: Config-defaultConfig = Config False False False Nothing QC.stdArgs ColorAuto specdoc False (Left stdout)+defaultConfig = Config False False False Nothing QC.stdArgs 5 ColorAuto specdoc False (Left stdout)  -- | Add a filter predicate to config.  If there is already a filter predicate, -- then combine them with `||`.@@ -62,6 +64,7 @@   , configFastFail        = optionsFastFail opts   , configFilterPredicate = matchFilter `filterOr` rerunFilter   , configQuickCheckArgs  = qcArgs+  , configSmallCheckDepth = fromMaybe (configSmallCheckDepth defaultConfig) (optionsDepth opts)   , configColorMode       = optionsColorMode opts   , configFormatter       = optionsFormatter opts   , configHtmlOutput      = optionsHtmlOutput opts
src/Test/Hspec/Core/Type.hs view
@@ -67,8 +67,9 @@ type Progress = (Int, Int)  data Params = Params {-  paramsQuickCheckArgs :: QC.Args-, paramsReportProgress :: Progress -> IO ()+  paramsQuickCheckArgs  :: QC.Args+, paramsSmallCheckDepth :: Int+, paramsReportProgress  :: Progress -> IO () }  -- | Internal representation of a spec.
src/Test/Hspec/Options.hs view
@@ -25,6 +25,7 @@ , optionsFastFail     :: Bool , optionsMatch        :: [String] , optionsMaxSuccess   :: Maybe Int+, optionsDepth        :: Maybe Int , optionsSeed         :: Maybe Integer , optionsMaxSize      :: Maybe Int , optionsMaxDiscardRatio :: Maybe Int@@ -37,6 +38,9 @@ addMatch :: String -> Options -> Options addMatch s c = c {optionsMatch = s : optionsMatch c} +setDepth :: Int -> Options -> Options+setDepth n c = c {optionsDepth = Just n}+ setMaxSuccess :: Int -> Options -> Options setMaxSuccess n c = c {optionsMaxSuccess = Just n} @@ -53,7 +57,7 @@   deriving (Eq, Show)  defaultOptions :: Options-defaultOptions = Options False False False False [] Nothing Nothing Nothing Nothing ColorAuto specdoc False Nothing+defaultOptions = Options False False False False [] Nothing Nothing Nothing Nothing Nothing ColorAuto specdoc False Nothing  formatters :: [(String, Formatter)] formatters = [@@ -95,6 +99,7 @@   , Option   []  ["no-color"]         (NoArg setNoColor)                  (h "do not colorize the output")   , 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 []   "depth"             (Arg "N" readMaybe setDepth)        (h "maximum depth of generated test values for SmallCheck properties")   , 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")
src/Test/Hspec/Runner/Eval.hs view
@@ -82,7 +82,7 @@     evalExample :: (Params -> IO Result) -> (Progress -> IO ()) -> IO (Either E.SomeException Result)     evalExample e progressHandler       | configDryRun c = return (Right Success)-      | otherwise      = (safeTry . fmap forceResult) (e $ Params (configQuickCheckArgs c) progressHandler)+      | otherwise      = (safeTry . fmap forceResult) (e $ Params (configQuickCheckArgs c) (configSmallCheckDepth c) progressHandler)  replaceMVar :: MVar a -> a -> IO () replaceMVar mvar p = tryTakeMVar mvar >> putMVar mvar p
test/Helper.hs view
@@ -66,7 +66,7 @@         | otherwise  = x  defaultParams :: H.Params-defaultParams = H.Params (H.configQuickCheckArgs H.defaultConfig) (const $ return ())+defaultParams = H.Params (H.configQuickCheckArgs H.defaultConfig) (H.configSmallCheckDepth H.defaultConfig) (const $ return ())  sleep :: POSIXTime -> IO () sleep = threadDelay . floor . (* 1000000)
test/Test/Hspec/OptionsSpec.hs view
@@ -38,3 +38,7 @@       context "when given an invalid argument" $ do         it "returns an error message" $ do           fromLeft (parseOptions ["--qc-max-success", "foo"]) `shouldBe` (ExitFailure 1, "my-spec: invalid argument `foo' for `--qc-max-success'\nTry `my-spec --help' for more information.\n")++    context "with --depth" $ do+      it "sets depth parameter for SmallCheck" $ do+        optionsDepth <$> parseOptions ["--depth", "23"] `shouldBe` Right (Just 23)