packages feed

hspec-contrib 0.3.0 → 0.4.0

raw patch · 4 files changed

+16/−10 lines, 4 filesdep ~hspec-corePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hspec-core

API changes (from Hackage documentation)

- Test.Hspec.Contrib.Retry: instance Example a => Example (Retry a)
+ Test.Hspec.Contrib.Retry: instance Test.Hspec.Core.Example.Example a => Test.Hspec.Core.Example.Example (Test.Hspec.Contrib.Retry.Retry a)

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2011-2015 Simon Hengel <sol@typeful.net>+Copyright (c) 2011-2017 Simon Hengel <sol@typeful.net> Copyright (c) 2011-2012 Trystan Spangler <trystan.s@comcast.net> Copyright (c) 2011-2011 Greg Weber <greg@gregweber.info> 
hspec-contrib.cabal view
@@ -1,8 +1,8 @@ name:             hspec-contrib-version:          0.3.0+version:          0.4.0 license:          MIT license-file:     LICENSE-copyright:        (c) 2011-2015 Simon Hengel,+copyright:        (c) 2011-2017 Simon Hengel,                   (c) 2014 Junji Hashimoto  maintainer:       Simon Hengel <sol@typeful.net>
src/Test/Hspec/Contrib/Retry.hs view
@@ -9,12 +9,18 @@  instance Example a => Example (Retry a) where   type Arg (Retry a) = Arg a-  evaluateExample (Retry n example) a b c = do-    v <- evaluateExample example a b c-    case v of-      Success -> return v-      _ | n > 1 -> evaluateExample (Retry (pred n) example) a b c-      _ -> return v+  evaluateExample (Retry n example) a b c+    | n > 1 = do+        r <- safeEvaluateExample example a b c+        case r of+          Right result -> case result of+            Success{} -> return result+            Pending{} -> return result+            Failure{} -> retry+          Left _ -> retry+    | otherwise = evaluateExample example a b c+    where+      retry = evaluateExample (Retry (pred n) example) a b c  -- | Retry evaluating example that may be failed until success. retryWith :: Int
test/Test/Hspec/Contrib/RetrySpec.hs view
@@ -9,7 +9,7 @@  spec :: Spec spec = do-  describe "retry test" $ do+  describe "retryWith" $ do     ref <- runIO $ newIORef (0::Int)     it "retry 11 times, then check the value" $ do       let incr :: IO Int