packages feed

hedgehog 0.5.2 → 0.5.3

raw patch · 8 files changed

+92/−17 lines, 8 filesdep ~asyncdep ~exceptionsdep ~lifted-asyncPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: async, exceptions, lifted-async, pretty-show

API changes (from Hackage documentation)

+ Hedgehog: (/==) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m ()
+ Hedgehog.Internal.Gen: instance (GHC.Base.Monad m, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Hedgehog.Internal.Gen.GenT m a)
+ Hedgehog.Internal.Gen: instance (GHC.Base.Monad m, GHC.Base.Monoid a) => GHC.Base.Monoid (Hedgehog.Internal.Gen.GenT m a)
+ Hedgehog.Internal.Gen: isNoncharacter :: Char -> Bool
+ Hedgehog.Internal.Property: (/==) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m ()
- Hedgehog: infix 4 ===
+ Hedgehog: infix 4 /==
- Hedgehog.Internal.Property: infix 4 ===
+ Hedgehog.Internal.Property: infix 4 /==

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+## Version 0.5.3 (2018-03-12)++- Add `Semigroup` and `Monoid` instances for `GenT` that lift the inner `Monoid` ([#156][156], [@andrewthad][andrewthad])+- `Gen.unicode` no longer generates non-characters ([#154][154], [@johnchandlerburnham][johnchandlerburnham])+- Documentation improvements ([#162][162], [@fisx][fisx])+- Documentation fixes ([#157][157], [@dredozubov][dredozubov])+ ## Version 0.5.2 (2018-02-05)  - Add doc explaining use of `withTests 1` ([#134][134], [@chris-martin][chris-martin])@@ -78,7 +85,23 @@   https://github.com/gwils [LightAndLight]:   https://github.com/LightAndLight+[johnchandlerburnham]:+  https://github.com/johnchandlerburnham+[andrewthad]:+  https://github.com/andrewthad+[dredozubov]:+  https://github.com/dredozubov+[fisx]:+  https://github.com/fisx +[162]:+  https://github.com/hedgehogqa/haskell-hedgehog/pull/162+[157]:+  https://github.com/hedgehogqa/haskell-hedgehog/pull/157+[156]:+  https://github.com/hedgehogqa/haskell-hedgehog/pull/156+[154]:+  https://github.com/hedgehogqa/haskell-hedgehog/pull/154 [150]:   https://github.com/hedgehogqa/haskell-hedgehog/pull/150 [142]:
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2017, Jacob Stanley+Copyright 2017-2018, Jacob Stanley All Rights Reserved.  Redistribution and use in source and binary forms, with or without
hedgehog.cabal view
@@ -1,4 +1,4 @@-version: 0.5.2+version: 0.5.3  name:   hedgehog@@ -49,13 +49,13 @@   build-depends:       base                            >= 3          && < 5     , ansi-terminal                   >= 0.6        && < 0.9-    , async                           >= 2.0        && < 2.2+    , async                           >= 2.0        && < 2.3     , bytestring                      >= 0.10       && < 0.11     , concurrent-output               >= 1.7        && < 1.11     , containers                      >= 0.4        && < 0.6     , directory                       >= 1.2        && < 1.4-    , exceptions                      >= 0.7        && < 0.9-    , lifted-async                    >= 0.7        && < 0.10+    , exceptions                      >= 0.7        && < 0.11+    , lifted-async                    >= 0.7        && < 0.11     , mmorph                          >= 1.0        && < 1.2     , monad-control                   >= 1.0        && < 1.1     , mtl                             >= 2.1        && < 2.3
src/Hedgehog.hs view
@@ -98,6 +98,7 @@   , failure   , assert   , (===)+  , (/==)   , tripping    , eval@@ -146,7 +147,7 @@ import           Hedgehog.Internal.HTraversable (HTraversable(..)) import           Hedgehog.Internal.Opaque (Opaque(..)) import           Hedgehog.Internal.Property (annotate, annotateShow)-import           Hedgehog.Internal.Property (assert, (===))+import           Hedgehog.Internal.Property (assert, (===), (/==)) import           Hedgehog.Internal.Property (discard, failure, success) import           Hedgehog.Internal.Property (DiscardLimit, withDiscards) import           Hedgehog.Internal.Property (eval, evalM, evalIO)
src/Hedgehog/Internal/Gen.hs view
@@ -142,6 +142,7 @@    -- ** Characters   , isSurrogate+  , isNoncharacter    -- ** Subterms   , Vec(..)@@ -152,7 +153,7 @@   , renderNodes   ) where -import           Control.Applicative (Alternative(..))+import           Control.Applicative (Alternative(..),liftA2) import           Control.Monad (MonadPlus(..), filterM, replicateM, ap, join) import           Control.Monad.Base (MonadBase(..)) import           Control.Monad.Catch (MonadThrow(..), MonadCatch(..))@@ -189,6 +190,8 @@ import           Data.Map (Map) import qualified Data.Map as Map import qualified Data.Maybe as Maybe+import           Data.Semigroup (Semigroup)+import qualified Data.Semigroup as Semigroup import           Data.Sequence (Seq) import qualified Data.Sequence as Seq import           Data.Set (Set)@@ -521,6 +524,13 @@ ------------------------------------------------------------------------ -- GenT instances +instance (Monad m, Semigroup a) => Semigroup (GenT m a) where+  (<>) = liftA2 (Semigroup.<>)++instance (Monad m, Monoid a) => Monoid (GenT m a) where+  mappend = liftA2 mappend+  mempty = return mempty+ instance Functor m => Functor (GenT m) where   fmap f gen =     GenT $ \seed size ->@@ -1036,14 +1046,14 @@ latin1 =   enum '\0' '\255' --- | Generates a Unicode character, excluding invalid standalone surrogates:+-- | Generates a Unicode character, excluding noncharacters and invalid standalone surrogates: --   @'\0'..'\1114111' (excluding '\55296'..'\57343')@ -- unicode :: MonadGen m => m Char unicode =-  filter (not . isSurrogate) unicodeAll+  filter (not . isNoncharacter) $ filter (not . isSurrogate) unicodeAll --- | Generates a Unicode character, including invalid standalone surrogates:+-- | Generates a Unicode character, including noncharacters and invalid standalone surrogates: --   @'\0'..'\1114111'@ -- unicodeAll :: MonadGen m => m Char@@ -1055,6 +1065,12 @@ isSurrogate :: Char -> Bool isSurrogate x =   x >= '\55296' && x <= '\57343'++-- | Check if a character is one of the noncharacters '\65534', '\65535'.+--+isNoncharacter :: Char -> Bool+isNoncharacter x =+  x == '\65534' || x == '\65535'  ------------------------------------------------------------------------ -- Combinators - Strings
src/Hedgehog/Internal/HTraversable.hs view
@@ -7,5 +7,7 @@  -- | Higher-order traversable functors. --+-- This is used internally to make symbolic variables concrete given an 'Environment'.+-- class HTraversable t where   htraverse :: Applicative f => (forall a. g a -> f (h a)) -> t g -> f (t h)
src/Hedgehog/Internal/Property.hs view
@@ -55,6 +55,7 @@   , success   , assert   , (===)+  , (/==)    , eval   , evalM@@ -552,6 +553,22 @@   else     withFrozenCallStack $ failDiff x y +infix 4 /==++-- | Fails the test if the two arguments provided are equal.+--+(/==) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m ()+(/==) x y = do+  ok <- withFrozenCallStack $ eval (x /= y)+  if ok then+    success+  else+    withFrozenCallStack $+      failWith Nothing $ unlines [+          "━━━ Both equal to ━━━"+        , showPretty x+        ]+ -- | Fails the test if the value throws an exception when evaluated to weak --   head normal form (WHNF). --@@ -728,7 +745,7 @@ mapConfig f (Property cfg t) =   Property (f cfg) t --- | Set the number times a property should be executed before it is considered+-- | Set the number of times a property should be executed before it is considered --   successful. -- --   If you have a test that does not involve any generators and thus does not@@ -739,21 +756,21 @@ withTests n =   mapConfig $ \config -> config { propertyTestLimit = n } --- | Set the number times a property is allowed to discard before the test+-- | Set the number of times a property is allowed to discard before the test --   runner gives up. -- withDiscards :: DiscardLimit -> Property -> Property withDiscards n =   mapConfig $ \config -> config { propertyDiscardLimit = n } --- | Set the number times a property is allowed to shrink before the test+-- | Set the number of times a property is allowed to shrink before the test --   runner gives up and prints the counterexample. -- withShrinks :: ShrinkLimit -> Property -> Property withShrinks n =   mapConfig $ \config -> config { propertyShrinkLimit = n } --- | Set the number times a property will be executed for each shrink before+-- | Set the number of times a property will be executed for each shrink before --   the test runner gives up and tries a different shrink. See 'ShrinkRetries' --   for more information. --
src/Hedgehog/Internal/Range.hs view
@@ -72,6 +72,10 @@ -- | A range describes the bounds of a number to generate, which may or may not --   be dependent on a 'Size'. --+--   The constructor takes an origin between the lower and upper bound, and a+--   function from 'Size' to bounds.  As the size goes towards @0@, the values+--   go towards the origin.+-- data Range a =   Range !a (Size -> (a, a)) @@ -164,7 +168,11 @@ --   >>> origin $ constantFrom 2000 1970 2100 --   2000 ---constantFrom :: a -> a -> a -> Range a+constantFrom ::+     a -- ^ Origin (the value produced when the size parameter is 0).+  -> a -- ^ Lower bound (the bottom of the range when the size parameter is 99).+  -> a -- ^ Upper bound (the top of the range when the size parameter is 99).+  -> Range a constantFrom z x y =   Range z $ \_ -> (x, y) @@ -210,7 +218,11 @@ --   >>> bounds 99 $ linearFrom 0 (-10) 20 --   (-10,20) ---linearFrom :: Integral a => a -> a -> a -> Range a+linearFrom :: Integral a+  => a -- ^ Origin (the value produced when the size parameter is 0).+  -> a -- ^ Lower bound (the bottom of the range when the size parameter is 99).+  -> a -- ^ Upper bound (the top of the range when the size parameter is 99).+  -> Range a linearFrom z x y =   Range z $ \sz ->     let@@ -353,7 +365,11 @@ --   >>> bounds 99 $ exponentialFrom x (-128) 512 --   (-128,512) ---exponentialFrom :: Integral a => a -> a -> a -> Range a+exponentialFrom :: Integral a+  => a -- ^ Origin (the value produced when the size parameter is 0).+  -> a -- ^ Lower bound (the bottom of the range when the size parameter is 99).+  -> a -- ^ Upper bound (the top of the range when the size parameter is 99).+  -> Range a exponentialFrom z x y =   Range z $ \sz ->     let