packages feed

test-sandbox-quickcheck 0.0.1.5 → 0.0.1.6

raw patch · 2 files changed

+22/−16 lines, 2 filesdep ~QuickCheckdep ~test-sandboxnew-uploader

Dependency ranges changed: QuickCheck, test-sandbox

Files

src/Test/Sandbox/QuickCheck.hs view
@@ -9,25 +9,22 @@   , verboseCheckWith   ) where -import Control.Monad.Trans (lift, liftIO)-import Control.Monad.Trans.Error (runErrorT)-import Control.Monad.Trans.Reader (runReaderT)+import Control.Monad.Trans (liftIO) import Control.Monad.Error.Class (throwError) import Control.Monad.Reader (ask) import Data.Maybe (fromMaybe) import System.Exit (exitFailure) import System.Random -#if !MIN_VERSION_QuickCheck(2,6,0)-import Data.List (isInfixOf)-#endif- import Test.Sandbox.Internals  import Test.QuickCheck hiding (quickCheck, quickCheckWith, verboseCheck, verboseCheckWith) import Test.QuickCheck.Monadic-import Test.QuickCheck.Property hiding (Result, interrupted, reason)+import Test.QuickCheck.Property ()+import Test.QuickCheck.Random+import Test.QuickCheck.Exception + -- | Tests a property and prints the results to stdout. quickCheck :: PropertyM Sandbox () -> Sandbox () quickCheck prop = getQuickCheckOptions@@ -52,7 +49,10 @@   ref <- ask   res <- liftIO . tester $ monadic (runSandboxProperty ref) prop   case res of-#if MIN_VERSION_QuickCheck(2,6,0)+#if MIN_VERSION_QuickCheck(2,7,0)+    Failure { theException = e, output = o } -> if fmap isInterrupt e == Just True then liftIO exitFailure+                                                  else throwError (o ++ maybe "" (\s -> " (used seed " ++ show s ++ ")") seed)+#elif MIN_VERSION_QuickCheck(2,6,0)     Failure { interrupted = i, output = o } -> if i then liftIO exitFailure                                                  else throwError (o ++ maybe "" (\s -> " (used seed " ++ show s ++ ")") seed) #else@@ -63,8 +63,8 @@     _ -> return ()  runSandboxProperty :: SandboxStateRef -> Sandbox Property -> Property-runSandboxProperty ref prop = morallyDubiousIOProperty $-  (runReaderT . runErrorT . runSandbox) prop ref >>= either error return+runSandboxProperty ref prop = ioProperty $+  runSandbox prop ref >>= either error return  getQuickCheckOptions :: Sandbox (Maybe Args) getQuickCheckOptions = do@@ -72,20 +72,24 @@   case options of     Nothing -> do       (gen, seed) <- randomSeed-      setVariable seedVariable (Just seed)+      _ <- setVariable seedVariable (Just seed)       return $ Just stdArgs { replay = Just (gen, 0) }     Just stuff -> do       (gen, seed) <- case stoSeed stuff of                        Nothing -> randomSeed                        Just SandboxRandomSeed -> randomSeed                        Just (SandboxFixedSeed i) -> fixedSeed i-      setVariable seedVariable (Just seed)+      _ <- setVariable seedVariable (Just seed)       return $ Just stdArgs { replay = Just (gen, 0)                             , maxSuccess = fromMaybe (maxSuccess stdArgs) (stoMaximumGeneratedTests stuff)                             , maxDiscardRatio = fromMaybe (maxDiscardRatio stdArgs) (stoMaximumUnsuitableGeneratedTests stuff)                             , maxSize = fromMaybe (maxSize stdArgs) (stoMaximumTestSize stuff) }   where randomSeed = liftIO randomIO >>= fixedSeed+#if MIN_VERSION_QuickCheck(2,7,0)+        fixedSeed s = return (mkQCGen s, s)+#else         fixedSeed s = return (mkStdGen s, s)+#endif  seedVariable :: String seedVariable = "__QUICKCHECK_SEED__"
test-sandbox-quickcheck.cabal view
@@ -1,5 +1,5 @@ Name:           test-sandbox-quickcheck-Version:        0.0.1.5+Version:        0.0.1.6 Cabal-Version:  >= 1.14 Category:       Testing Synopsis:       QuickCheck convenience functions for use with test-sandbox@@ -18,14 +18,16 @@ Source-Repository this     Type:       git     Location:   https://github.com/gree/haskell-test-sandbox-    Tag:        test-sandbox-quickcheck_0.0.1.5+    Tag:        test-sandbox-quickcheck_0.0.1.6  Library     Exposed-modules:    Test.Sandbox.QuickCheck      Build-Depends:      base >=4 && <5, mtl, random, transformers,-                        test-sandbox >=0.0.1.5 && <0.0.2, QuickCheck >=2.1+                        test-sandbox >=0.0.1.9 && <0.0.2, QuickCheck >=2.7      Hs-source-dirs:     src      Default-Language:   Haskell2010++    ghc-options:       -Wall