packages feed

test-framework-quickcheck2 0.2.4 → 0.2.5

raw patch · 2 files changed

+12/−9 lines, 2 filesdep ~QuickCheckdep ~extensible-exceptionsdep ~test-framework

Dependency ranges changed: QuickCheck, extensible-exceptions, test-framework

Files

Test/Framework/Providers/QuickCheck2.hs view
@@ -13,14 +13,12 @@  import Test.QuickCheck.Gen import Test.QuickCheck.Property hiding ( Property )-import Test.QuickCheck.Test ( run, maxSize, stdArgs, callbackPostTest, callbackPostFinalFailure )+import Test.QuickCheck.Test ( maxSize, stdArgs, callbackPostTest, callbackPostFinalFailure ) import Test.QuickCheck.Text import Test.QuickCheck.State  import qualified Control.Exception.Extensible as E -import Data.List- import System.Random  @@ -132,10 +130,12 @@ myRunATest :: State -> (StdGen -> Int -> Prop) -> ImprovingIO PropertyTestCount f (PropertyStatus, PropertyTestCount) myRunATest st f = do     let size = computeSize st (numSuccessTests st) (numDiscardedTests st)-        (rnd1, rnd2) = split (randomSeed st)     -- Careful to catch exceptions, or else they might bring down the whole test framework-    ei_st_res <- liftIO $ E.catch (fmap Right $ run (unProp (f rnd1 size)))-                                  (\e -> return $ Left $ show (e :: E.SomeException))+    ei_st_res <- liftIO $ flip E.catch (\e -> return $ Left $ show (e :: E.SomeException)) $ do+                                  MkRose mres ts <- protectRose (unProp (f rnd1 size))+                                  res <- mres+                                  return (Right (res, ts))+                                       case ei_st_res of        Left text -> return (PropertyException text, numSuccessTests st + 1)        Right (res, ts) -> do@@ -161,6 +161,8 @@                           -- Could terminate immediately without any shrinking by doing this instead:                           -- return (PropertyFalsifiable (reason res), numSuccessTests st + 1)                      else return (PropertyOK, numSuccessTests st + 1)+  where+   (rnd1,rnd2) = split (randomSeed st)   -- | This function eventually reports a failure but attempts to shrink the counterexample before it does so@@ -174,7 +176,8 @@     return (PropertyFalsifiable (reason res), numSuccessTests st + 1)  myLocalMin st res (t : ts) =-  do (res', ts') <- run t+  do MkRose mres' ts' <- protectRose t+     res' <- mres'      callbackPostTest st res'            -- NB: both (numSuccessShrinks st) (numTryShrinks st) contain interesting information here.
test-framework-quickcheck2.cabal view
@@ -1,5 +1,5 @@ Name:                test-framework-quickcheck2-Version:             0.2.4+Version:             0.2.5 Cabal-Version:       >= 1.2.3 Category:            Testing Synopsis:            QuickCheck2 support for the test-framework package.@@ -22,7 +22,7 @@ Library         Exposed-Modules:        Test.Framework.Providers.QuickCheck2         -        Build-Depends:          test-framework >= 0.2.0, QuickCheck >= 2.1.0.0, extensible-exceptions >= 0.1.1+        Build-Depends:          test-framework >= 0.2.0 && < 0.3.0, QuickCheck >= 2.1.0.3 && < 2.2.0.0, extensible-exceptions >= 0.1.1 && < 0.2.0         if flag(base3)                 Build-Depends:          base >= 3 && < 4, random >= 1         else