packages feed

tasty-quickcheck 0.9 → 0.9.1

raw patch · 3 files changed

+45/−18 lines, 3 files

Files

CHANGELOG.md view
@@ -1,6 +1,11 @@ Changes ======= +Version 0.9.1+-------------++* Expose internal `optionSetToArgs` function+ Version 0.9 ------------- 
Test/Tasty/QuickCheck.hs view
@@ -10,10 +10,11 @@   , QuickCheckVerbose(..)   , module Test.QuickCheck     -- * Internal-    -- | This is exposed for testing purposes and not considered as a part-    -- of the public API.-    -- You probably shouldn't need it.+    -- | If you are building a test suite, you don't need these functions.+    --+    -- They may be used by other tasty add-on packages (such as tasty-hspec).   , QC(..)+  , optionSetToArgs   ) where  import Test.Tasty.Providers@@ -115,6 +116,34 @@   optionHelp = return "Show the generated test cases"   optionCLParser = mkFlagCLParser mempty (QuickCheckVerbose True) +-- | Convert tasty options into QuickCheck options.+--+-- This is a low-level function that was originally added for tasty-hspec+-- but may be used by others.+--+-- @since 0.9.1+optionSetToArgs :: OptionSet -> IO (Int, QC.Args)+optionSetToArgs opts = do+  replaySeed <- case mReplay of+    Nothing -> getStdRandom (randomR (1,999999))+    Just seed -> return seed++  let args = QC.stdArgs+        { QC.chatty          = False+        , QC.maxSuccess      = nTests+        , QC.maxSize         = maxSize+        , QC.replay          = Just (mkQCGen replaySeed, 0)+        , QC.maxDiscardRatio = maxRatio+        }++  return (replaySeed, args)++  where+    QuickCheckTests    nTests   = lookupOption opts+    QuickCheckReplay   mReplay  = lookupOption opts+    QuickCheckMaxSize  maxSize  = lookupOption opts+    QuickCheckMaxRatio maxRatio = lookupOption opts+ instance IsTest QC where   testOptions = return     [ Option (Proxy :: Proxy QuickCheckTests)@@ -126,22 +155,15 @@     ]    run opts (QC prop) yieldProgress = do+    (replaySeed, args) <- optionSetToArgs opts+     let-      QuickCheckTests      nTests     = lookupOption opts-      QuickCheckReplay     mReplay    = lookupOption opts       QuickCheckShowReplay showReplay = lookupOption opts-      QuickCheckMaxSize    maxSize    = lookupOption opts-      QuickCheckMaxRatio   maxRatio   = lookupOption opts       QuickCheckVerbose    verbose    = lookupOption opts+      maxSize = QC.maxSize args       testRunner = if verbose                      then QC.verboseCheckWithResult                      else QC.quickCheckWithResult-    replaySeed <- case mReplay of-      Nothing -> getStdRandom (randomR (1,999999))-      Just seed -> return seed-    let-      replay = Just (mkQCGen replaySeed, 0)-      args = QC.stdArgs { QC.chatty = False, QC.maxSuccess = nTests, QC.maxSize = maxSize, QC.replay = replay, QC.maxDiscardRatio = maxRatio}       replayMsg = makeReplayMsg replaySeed maxSize      -- Quickcheck already catches exceptions, no need to do it here.
tasty-quickcheck.cabal view
@@ -1,15 +1,15 @@--- Initial tasty-quickcheck.cabal generated by cabal init.  For further +-- Initial tasty-quickcheck.cabal generated by cabal init.  For further -- documentation, see http://haskell.org/cabal/users-guide/  name:                tasty-quickcheck-version:             0.9+version:             0.9.1 synopsis:            QuickCheck support for the Tasty test framework. description:         QuickCheck support for the Tasty test framework. license:             MIT license-file:        LICENSE author:              Roman Cheplyaka <roma@ro-che.info> maintainer:          Roman Cheplyaka <roma@ro-che.info>--- copyright:           +-- copyright: homepage:            http://documentup.com/feuerbach/tasty bug-reports:         https://github.com/feuerbach/tasty/issues category:            Testing@@ -24,11 +24,11 @@  library   exposed-modules:     Test.Tasty.QuickCheck-  -- other-modules:       +  -- other-modules:   other-extensions:    GeneralizedNewtypeDeriving, DeriveDataTypeable   build-depends:       base == 4.*, tagged, tasty >= 0.10.1, random, QuickCheck >= 2.7 -  -- hs-source-dirs:      +  -- hs-source-dirs:   default-language:    Haskell2010  test-suite test