packages feed

test-sandbox-quickcheck 0.0.1.3 → 0.0.1.4

raw patch · 2 files changed

+17/−17 lines, 2 filesdep ~test-sandbox

Dependency ranges changed: test-sandbox

Files

src/Test/Sandbox/QuickCheck.hs view
@@ -11,8 +11,9 @@  import Control.Monad.Trans (lift, liftIO) import Control.Monad.Trans.Error (runErrorT)-import Control.Monad.State.Strict (get, evalStateT)+import Control.Monad.Trans.Reader (runReaderT) import Control.Monad.Error.Class (throwError)+import Control.Monad.Reader (ask) import Data.Maybe (fromMaybe) import System.Exit (exitFailure) import System.Random@@ -48,23 +49,22 @@ quickCheck' :: (Property -> IO Result) -> PropertyM Sandbox () -> Sandbox () quickCheck' tester prop = do   seed <- getVariable seedVariable Nothing :: Sandbox (Maybe Int)-  Sandbox $ do-    env <- lift get-    res <- liftIO . tester $ monadic (runSandboxProperty env) prop-    case res of+  ref <- ask+  res <- liftIO . tester $ monadic (runSandboxProperty ref) prop+  case res of #if 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)+    Failure { interrupted = i, output = o } -> if i then liftIO exitFailure+                                                 else throwError (o ++ maybe "" (\s -> " (used seed " ++ show s ++ ")") seed) #else-      Failure { reason = r, output = o } -> if "user interrupt" `isInfixOf` r then liftIO exitFailure-                                              else throwError (o ++ maybe "" (\s -> " (used seed " ++ show s ++ ")") seed)+    Failure { reason = r, output = o } -> if "user interrupt" `isInfixOf` r then liftIO exitFailure+                                            else throwError (o ++ maybe "" (\s -> " (used seed " ++ show s ++ ")") seed) #endif-      NoExpectedFailure { output = o } -> throwError o-      _ -> return ()+    NoExpectedFailure { output = o } -> throwError o+    _ -> return () -runSandboxProperty :: SandboxState -> Sandbox Property -> Property-runSandboxProperty env prop = morallyDubiousIOProperty $-  (evalStateT . runErrorT . runSandbox) prop env >>= either error return+runSandboxProperty :: SandboxStateRef -> Sandbox Property -> Property+runSandboxProperty ref prop = morallyDubiousIOProperty $+  (runReaderT . runErrorT . runSandbox) prop ref >>= either error return  getQuickCheckOptions :: Sandbox (Maybe Args) getQuickCheckOptions = do
test-sandbox-quickcheck.cabal view
@@ -1,5 +1,5 @@ Name:           test-sandbox-quickcheck-Version:        0.0.1.3+Version:        0.0.1.4 Cabal-Version:  >= 1.14 Category:       Testing Synopsis:       QuickCheck convenience functions for use with test-sandbox@@ -18,13 +18,13 @@ Source-Repository this     Type:       git     Location:   https://github.com/gree/haskell-test-sandbox-    Tag:        test-sandbox-quickcheck_0.0.1.3+    Tag:        test-sandbox-quickcheck_0.0.1.4  Library     Exposed-modules:    Test.Sandbox.QuickCheck      Build-Depends:      base >=4 && <5, mtl, random, transformers,-                        test-sandbox == 0.0.1.*, QuickCheck >=2.1+                        test-sandbox >=0.0.1.5 && <0.0.2, QuickCheck >=2.1      Hs-source-dirs:     src