packages feed

genvalidity-property 0.4.0.0 → 0.5.0.0

raw patch · 4 files changed

+21/−12 lines, 4 filesdep +pretty-showPVP ok

version bump matches the API change (PVP)

Dependencies added: pretty-show

API changes (from Hackage documentation)

- Test.Validity.GenValidity.Property: genGeneratesInvalid :: forall a. (Show a, Validity a) => Gen a -> (a -> [a]) -> Property
+ Test.Validity.GenValidity.Property: genGeneratesInvalid :: forall a. (Show a, Validity a) => Gen a -> Property
- Test.Validity.GenValidity.Property: genGeneratesValid :: forall a. (Show a, Validity a) => Gen a -> (a -> [a]) -> Property
+ Test.Validity.GenValidity.Property: genGeneratesValid :: forall a. (Show a, Validity a) => Gen a -> Property
- Test.Validity.Property: genGeneratesInvalid :: forall a. (Show a, Validity a) => Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: genGeneratesInvalid :: forall a. (Show a, Validity a) => Gen a -> Property
- Test.Validity.Property: genGeneratesValid :: forall a. (Show a, Validity a) => Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: genGeneratesValid :: forall a. (Show a, Validity a) => Gen a -> Property

Files

genvalidity-property.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: 10434d85507b6aae25f65eb574518c1631521ad8fe1f6fabaae6ea9ef148f055+-- hash: 72e1dc8a07fd73ec8014692a871754cdd0b731054f8292e05800699e48c5c63a  name:           genvalidity-property-version:        0.4.0.0+version:        0.5.0.0 synopsis:       Standard properties for functions on `Validity` types description:    Standard properties for functions on `Validity` types category:       Testing@@ -57,6 +57,7 @@     , base >=4.7 && <5     , genvalidity >=0.7     , hspec >=2.1+    , pretty-show     , validity >=0.9   default-language: Haskell2010 
src/Test/Validity/Functions/CanFail.hs view
@@ -30,10 +30,13 @@  import Data.GenValidity +import Text.Show.Pretty (ppShow)+ import Test.Hspec import Test.QuickCheck  import Test.Validity.Types+import Test.Validity.Property.Utils  -- | The function succeeds if the input is generated by the given generator succeedsOnGen ::@@ -95,7 +98,7 @@     forAllShrink gen s $ \a ->         case resultIfSucceeded (func a) of             Nothing -> return () -- Can happen-            Just res -> res `shouldSatisfy` isValid+            Just res -> shouldBeValid res  -- | The function produces output that satisfies @isValid@ if it is given input -- that is generated by @arbitrary@.@@ -194,7 +197,7 @@     forAllShrink gen s $ \(a, b) ->         case resultIfSucceeded (func a b) of             Nothing -> return () -- Can happen-            Just res -> res `shouldSatisfy` isValid+            Just res -> shouldBeValid res  validIfSucceedsOnValids2 ::        ( Show a@@ -248,7 +251,7 @@     forAllShrink gen s $ \(a, b, c) ->         case resultIfSucceeded (func a b c) of             Nothing -> return () -- Can happen-            Just res -> res `shouldSatisfy` isValid+            Just res -> shouldBeValid res  validIfSucceedsOnValids3 ::        ( Show a
src/Test/Validity/GenValidity/Property.hs view
@@ -10,21 +10,20 @@  import Data.GenValidity -import Test.Hspec import Test.QuickCheck +import Test.Validity.Property.Utils+ -- | The given generator generates only valid data points genGeneratesValid ::        forall a. (Show a, Validity a)     => Gen a-    -> (a -> [a])     -> Property-genGeneratesValid gen s = forAllShrink gen s (`shouldSatisfy` isValid)+genGeneratesValid gen = forAll gen shouldBeValid  -- | The given generator generates only invalid data points genGeneratesInvalid ::        forall a. (Show a, Validity a)     => Gen a-    -> (a -> [a])     -> Property-genGeneratesInvalid gen s = forAllShrink gen s (`shouldSatisfy` isInvalid)+genGeneratesInvalid gen = forAll gen shouldBeInvalid
src/Test/Validity/Property/Utils.hs view
@@ -18,6 +18,8 @@ import Control.Applicative (pure) #endif +import Text.Show.Pretty (ppShow)+ forAllUnchecked ::        (Show a, GenUnchecked a, Testable prop) => (a -> prop) -> Property forAllUnchecked = forAllShrink genUnchecked shrinkUnchecked@@ -44,7 +46,9 @@             unlines                 [ "'validate' reported this value to be invalid: "                 , show a-                , "with explanation"+                , "pretty version:"+                , ppShow a+                , "with explanation:"                 , err                 , ""                 ]@@ -57,6 +61,8 @@             unlines                 [ "'validate' reported this value to be valid: "                 , show a+                , "pretty version:"+                , ppShow a                 , "where we expected it to be invalid"                 ]         Left _ -> pure ()