QuickCheck 2.8 → 2.8.1
raw patch · 6 files changed
+42/−26 lines, 6 filesdep ~QuickCheckdep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: QuickCheck, template-haskell
API changes (from Hackage documentation)
- Test.QuickCheck.Property: result :: Result
+ Test.QuickCheck.Exception: evaluate :: a -> IO a
Files
- QuickCheck.cabal +3/−3
- Test/QuickCheck/Exception.hs +6/−0
- Test/QuickCheck/Gen.hs +2/−1
- Test/QuickCheck/Property.hs +18/−22
- Test/QuickCheck/Text.hs +8/−0
- changelog +5/−0
QuickCheck.cabal view
@@ -1,5 +1,5 @@ Name: QuickCheck-Version: 2.8+Version: 2.8.1 Cabal-Version: >= 1.8 Build-type: Simple License: BSD3@@ -37,7 +37,7 @@ source-repository this type: git location: https://github.com/nick8325/quickcheck- tag: 2.8+ tag: 2.8.1 flag base3 Description: Choose the new smaller, split-up base package.@@ -158,7 +158,7 @@ build-depends: base, containers,- QuickCheck == 2.8,+ QuickCheck == 2.8.1, template-haskell >= 2.4, test-framework >= 0.4 && < 0.9 if flag(templateHaskell)
Test/QuickCheck/Exception.hs view
@@ -54,6 +54,9 @@ tryEvaluateIO :: IO a -> IO (Either AnException a) tryEvaluateIO m = fmap Right m +evaluate :: a -> IO a+evaluate x = x `seq` return x+ isInterrupt :: AnException -> Bool isInterrupt _ = False @@ -79,6 +82,9 @@ tryEvaluateIO :: IO a -> IO (Either AnException a) tryEvaluateIO m = E.try (m >>= E.evaluate) --tryEvaluateIO m = Right `fmap` m++evaluate :: a -> IO a+evaluate = E.evaluate -- | Test if an exception was a @^C@. -- QuickCheck won't try to shrink an interrupted test case.
Test/QuickCheck/Gen.hs view
@@ -88,7 +88,8 @@ choose :: Random a => (a,a) -> Gen a choose rng = MkGen (\r _ -> let (x,_) = randomR rng r in x) --- | Run a generator.+-- | Run a generator. The size passed to the generator is always 30;+-- if you want another size then you should explicitly use 'resize'. generate :: Gen a -> IO a generate (MkGen g) = do r <- newQCGen
Test/QuickCheck/Property.hs view
@@ -217,19 +217,6 @@ , callbacks :: [Callback] -- ^ the callbacks for this test case } -result :: Result-result =- MkResult- { ok = undefined- , expect = True- , reason = ""- , theException = Nothing- , abort = False- , labels = Map.empty- , stamp = Set.empty- , callbacks = []- }- exception :: String -> AnException -> Result exception msg err | isDiscard err = rejected@@ -244,14 +231,23 @@ protectResult :: IO Result -> IO Result protectResult = protect (exception "Exception") -succeeded :: Result-succeeded = result{ ok = Just True }--failed :: Result-failed = result{ ok = Just False }--rejected :: Result-rejected = result{ ok = Nothing }+succeeded, failed, rejected :: Result+(succeeded, failed, rejected) =+ (result{ ok = Just True },+ result{ ok = Just False },+ result{ ok = Nothing })+ where+ result =+ MkResult+ { ok = undefined+ , expect = True+ , reason = ""+ , theException = Nothing+ , abort = False+ , labels = Map.empty+ , stamp = Set.empty+ , callbacks = []+ } -------------------------------------------------------------------------- -- ** Lifting and mapping functions@@ -307,7 +303,7 @@ res <- tryEvaluateIO (putLine (terminal st) s) case res of Left err ->- putLine (terminal st) (formatException "Exception thrown by generator" err)+ putLine (terminal st) (formatException "Exception thrown while printing test case" err) Right () -> return ()
Test/QuickCheck/Text.hs view
@@ -126,8 +126,16 @@ putPart, putTemp, putLine :: Terminal -> String -> IO () putPart tm@(MkTerminal res _ out _) s = do flush tm+ force s out s modifyIORef res (++ s)+ where+ force :: [a] -> IO ()+ force = evaluate . seqList++ seqList :: [a] -> ()+ seqList [] = ()+ seqList (x:xs) = x `seq` seqList xs putLine tm s = putPart tm (s ++ "\n")
changelog view
@@ -1,3 +1,8 @@+QuickCheck 2.8.1 (released 2015-04-03)+ * Fix bug where exceptions thrown printing counterexamples weren't+ being caught when terminal output was disabled+ * Don't export Test.QuickCheck.Property.result+ QuickCheck 2.8 (released 2015-03-18) * New features: * Support for GHC 7.10