hedgehog 0.2.1 → 0.2.2
raw patch · 5 files changed
+93/−8 lines, 5 filesdep ~concurrent-outputdep ~template-haskelldep ~wl-pprint-annotatedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: concurrent-output, template-haskell, wl-pprint-annotated
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- hedgehog.cabal +7/−4
- src/Hedgehog/Gen.hs +2/−2
- src/Hedgehog/Internal/TH.hs +2/−2
- test/Test/Hedgehog/Text.hs +76/−0
CHANGELOG.md view
@@ -1,3 +1,9 @@+## Version 0.2.2 (2017-05-16)++- Fixed scope of `unicode` character generators.+- Widen version bounds for some dependencies.+- Expose test modules to fix build on nix / hydra.+ ## Version 0.2.1 (2017-05-09) - Added `ascii`, `latin1`, `unicode` character generators.
hedgehog.cabal view
@@ -1,7 +1,7 @@ name: hedgehog version:- 0.2.1+ 0.2.2 license: BSD3 author:@@ -50,7 +50,7 @@ , ansi-terminal >= 0.6 && < 0.7 , async >= 2.0 && < 2.2 , bytestring >= 0.10 && < 0.11- , concurrent-output >= 1.7 && < 1.8+ , concurrent-output >= 1.7 && < 2.0 , containers >= 0.4 && < 0.6 , directory >= 1.2 && < 1.4 , exceptions >= 0.7 && < 0.9@@ -61,13 +61,13 @@ , random >= 1.1 && < 1.2 , resourcet >= 1.1 && < 1.2 , stm >= 2.4 && < 2.5- , template-haskell >= 2.10 && < 2.12+ , template-haskell >= 2.10 && < 2.13 , text >= 1.1 && < 1.3 , th-lift >= 0.7 && < 0.8 , time >= 1.4 && < 1.9 , transformers >= 0.3 && < 0.6 , transformers-base >= 0.4 && < 0.5- , wl-pprint-annotated >= 0.0 && < 0.1+ , wl-pprint-annotated >= 0.0 && < 0.2 if impl(ghc < 8.0) build-depends:@@ -115,6 +115,9 @@ hs-source-dirs: test++ other-modules:+ Test.Hedgehog.Text build-depends: hedgehog
src/Hedgehog/Gen.hs view
@@ -749,7 +749,7 @@ enum '\0' '\255' -- | Generates a Unicode character, excluding invalid standalone surrogates:--- @'\0'..'\1114111' (excluding '\55296'..'\57344')@+-- @'\0'..'\1114111' (excluding '\55296'..'\57343')@ -- unicode :: Monad m => Gen m Char unicode =@@ -766,7 +766,7 @@ -- isSurrogate :: Char -> Bool isSurrogate x =- x >= '\55296' && x <= '\57344'+ x >= '\55296' && x <= '\57343' ------------------------------------------------------------------------ -- Combinators - Strings
src/Hedgehog/Internal/TH.hs view
@@ -12,8 +12,8 @@ import Hedgehog.Internal.Discovery import Hedgehog.Internal.Property -import Language.Haskell.TH-import Language.Haskell.TH.Syntax+import Language.Haskell.TH (Exp(..), Q, TExp, location, runIO)+import Language.Haskell.TH.Syntax (Loc(..), mkName, unTypeQ, unsafeTExpCoerce) type TExpQ a = Q (TExp a)
+ test/Test/Hedgehog/Text.hs view
@@ -0,0 +1,76 @@+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE ScopedTypeVariables #-}+module Test.Hedgehog.Text where++import Data.Int (Int64)+import Data.Typeable (Typeable)++import Hedgehog+import qualified Hedgehog.Gen as Gen+import qualified Hedgehog.Range as Range++import Text.Read (readEither)+++genSize :: Monad m => Gen m Size+genSize =+ Size <$> Gen.enumBounded++genOdd :: Monad m => Gen m Int64+genOdd =+ let+ mkOdd x =+ if odd x then+ x+ else+ pred x+ in+ mkOdd <$> Gen.int64 (Range.constant 1 maxBound)++genSeed :: Monad m => Gen m Seed+genSeed =+ Seed <$> Gen.enumBounded <*> genOdd++genPrecedence :: Monad m => Gen m Int+genPrecedence =+ Gen.int (Range.constant 0 11)++genString :: Monad m => Gen m String+genString =+ Gen.string (Range.constant 0 100) Gen.alpha++checkShowAppend :: (Typeable a, Show a) => Gen IO a -> Property+checkShowAppend gen =+ property $ do+ prec <- forAll genPrecedence+ x <- forAll gen+ xsuffix <- forAll genString+ ysuffix <- forAll genString+ showsPrec prec x xsuffix ++ ysuffix === showsPrec prec x (xsuffix ++ ysuffix)++trippingReadShow :: (Eq a, Typeable a, Show a, Read a) => Gen IO a -> Property+trippingReadShow gen =+ property $ do+ prec <- forAll genPrecedence+ x <- forAll gen+ tripping x (\z -> showsPrec prec z "") readEither++prop_show_append_size :: Property+prop_show_append_size =+ checkShowAppend genSize++prop_tripping_append_size :: Property+prop_tripping_append_size =+ trippingReadShow genSize++prop_show_append_seed :: Property+prop_show_append_seed =+ checkShowAppend genSeed++prop_tripping_append_seed :: Property+prop_tripping_append_seed =+ trippingReadShow genSeed++tests :: IO Bool+tests =+ checkParallel $$(discover)