tasty-quickcheck 0.9.1 → 0.9.2
raw patch · 4 files changed
+34/−9 lines, 4 filesdep ~tasty
Dependency ranges changed: tasty
Files
- CHANGELOG.md +6/−0
- Test/Tasty/QuickCheck.hs +17/−5
- tasty-quickcheck.cabal +7/−3
- tests/test.hs +4/−1
CHANGELOG.md view
@@ -1,6 +1,12 @@ Changes ======= +Version 0.9.2+-------------++* Add a `testProperties` function, which allows to test all QuickCheck+ properties defined in a module.+ Version 0.9.1 -------------
Test/Tasty/QuickCheck.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-} module Test.Tasty.QuickCheck ( testProperty+ , testProperties , QuickCheckTests(..) , QuickCheckReplay(..) , QuickCheckShowReplay(..)@@ -17,6 +18,7 @@ , optionSetToArgs ) where +import Test.Tasty ( testGroup ) import Test.Tasty.Providers import Test.Tasty.Options import qualified Test.QuickCheck as QC@@ -37,13 +39,15 @@ ) import Data.Typeable-import Data.Proxy import Data.List-import Data.Monoid import Text.Printf-import Control.Applicative-import Test.QuickCheck.Random (QCGen, mkQCGen)+import Test.QuickCheck.Random (mkQCGen) import System.Random (getStdRandom, randomR)+#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+import Data.Monoid+import Data.Proxy+#endif newtype QC = QC QC.Property deriving Typeable@@ -52,6 +56,14 @@ testProperty :: QC.Testable a => TestName -> a -> TestTree testProperty name prop = singleTest name $ QC $ QC.property prop +-- | Create a test from a list of QuickCheck properties. To be used+-- with 'Test.QuickCheck.allProperties'. E.g.+--+-- >tests :: TestTree+-- >tests = testProperties "Foo" $allProperties+testProperties :: TestName -> [(String, Property)] -> TestTree+testProperties name = testGroup name . map (uncurry testProperty)+ -- | Number of test cases for QuickCheck to generate newtype QuickCheckTests = QuickCheckTests Int deriving (Num, Ord, Eq, Real, Enum, Integral, Typeable)@@ -154,7 +166,7 @@ , Option (Proxy :: Proxy QuickCheckVerbose) ] - run opts (QC prop) yieldProgress = do+ run opts (QC prop) _yieldProgress = do (replaySeed, args) <- optionSetToArgs opts let
tasty-quickcheck.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: tasty-quickcheck-version: 0.9.1+version: 0.9.2 synopsis: QuickCheck support for the Tasty test framework. description: QuickCheck support for the Tasty test framework. license: MIT@@ -10,7 +10,7 @@ author: Roman Cheplyaka <roma@ro-che.info> maintainer: Roman Cheplyaka <roma@ro-che.info> -- copyright:-homepage: http://documentup.com/feuerbach/tasty+homepage: https://github.com/feuerbach/tasty bug-reports: https://github.com/feuerbach/tasty/issues category: Testing build-type: Simple@@ -30,10 +30,13 @@ -- hs-source-dirs: default-language: Haskell2010+ default-extensions: CPP+ ghc-options: -Wall test-suite test default-language: Haskell2010+ default-extensions: CPP type: exitcode-stdio-1.0 hs-source-dirs:@@ -42,7 +45,8 @@ test.hs build-depends: base >= 4 && < 5- , tasty >= 0.10+ , tasty >= 0.11.1 , tasty-quickcheck , tasty-hunit , pcre-light+ ghc-options: -Wall
tests/test.hs view
@@ -5,10 +5,12 @@ import Test.Tasty.Runners as Tasty import Test.Tasty.QuickCheck import Test.Tasty.HUnit-import Data.Monoid import Data.Maybe import Text.Regex.PCRE.Light.Char8 import Text.Printf+#if !MIN_VERSION_base(4,8,0)+import Data.Monoid (mempty)+#endif (=~), (!~) :: String -- ^ text@@ -34,6 +36,7 @@ in isJust $ match regex text [] +main :: IO () main = defaultMain $ testGroup "Unit tests for Test.Tasty.QuickCheck"