genvalidity-sydtest-aeson 0.0.0.0 → 1.0.0.0
raw patch · 5 files changed
+30/−28 lines, 5 filesdep ~genvalidity
Dependency ranges changed: genvalidity
Files
- CHANGELOG.md +11/−0
- LICENSE +1/−1
- genvalidity-sydtest-aeson.cabal +8/−5
- src/Test/Syd/Validity/Aeson.hs +7/−19
- test/Test/Syd/Validity/AesonSpec.hs +3/−3
+ CHANGELOG.md view
@@ -0,0 +1,11 @@+# Changelog++## [1.0.0.0] - 2021-11-20++* Compatibility with `genvalidity >= 1.0.0.0`+* Renamed every combinator that ends in `OnValid` (or similar) to not have that suffix anymore.++### Removed++* Every combinator that relates to unchecked or invalid values.+
LICENSE view
@@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 Tom Sydney Kerckhove+Copyright (c) 2016-2021 Tom Sydney Kerckhove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
genvalidity-sydtest-aeson.cabal view
@@ -1,21 +1,24 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.2.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack name: genvalidity-sydtest-aeson-version: 0.0.0.0+version: 1.0.0.0 synopsis: Standard spec's for aeson-related instances in sydtest category: Testing homepage: http://cs-syd.eu bug-reports: https://github.com/NorfairKing/validity/issues author: Tom Sydney Kerckhove maintainer: syd@cs-syd.eu-copyright: Copyright: (c) 2020 Tom Sydney Kerckhove+copyright: Copyright: (c) 2016-2021 Tom Sydney Kerckhove license: MIT license-file: LICENSE build-type: Simple+extra-source-files:+ LICENSE+ CHANGELOG.md source-repository head type: git@@ -35,7 +38,7 @@ , base >=4.9 && <=5 , bytestring , deepseq- , genvalidity >=0.5+ , genvalidity >=1.0 , genvalidity-sydtest , sydtest default-language: Haskell2010@@ -55,7 +58,7 @@ QuickCheck , aeson , base >=4.9 && <=5- , genvalidity >=0.7+ , genvalidity , genvalidity-aeson , genvalidity-sydtest , genvalidity-sydtest-aeson
src/Test/Syd/Validity/Aeson.hs view
@@ -6,8 +6,7 @@ -- -- You will need @TypeApplications@ to use these. module Test.Syd.Validity.Aeson- ( jsonSpecOnValid,- jsonSpec,+ ( jsonSpec, jsonSpecOnArbitrary, jsonSpecOnGen, neverFailsToEncodeOnGen,@@ -29,23 +28,12 @@ -- -- Example usage: ----- > jsonSpecOnValid @Rational-jsonSpecOnValid ::- forall a.- (Show a, Eq a, Typeable a, GenValid a, FromJSON a, ToJSON a) =>- Spec-jsonSpecOnValid = jsonSpecOnGen (genValid @a) "valid" shrinkValid---- | Standard test spec for properties of JSON-related functions for unchecked values------ Example usage:--- -- > jsonSpec @Int jsonSpec :: forall a.- (Show a, Eq a, Typeable a, GenUnchecked a, FromJSON a, ToJSON a) =>+ (Show a, Eq a, Typeable a, GenValid a, FromJSON a, ToJSON a) => Spec-jsonSpec = jsonSpecOnGen (genUnchecked @a) "unchecked" shrinkUnchecked+jsonSpec = jsonSpecOnGen (genValid @a) "valid" shrinkValid -- | Standard test spec for properties of JSON-related functions for arbitrary values --@@ -100,11 +88,11 @@ -- | -- -- prop> neverFailsToEncodeOnGen @Bool arbitrary shrink--- prop> neverFailsToEncodeOnGen @Bool genUnchecked shrinkUnchecked -- prop> neverFailsToEncodeOnGen @Bool genValid shrinkValid+-- prop> neverFailsToEncodeOnGen @Bool genValid shrinkValid -- prop> neverFailsToEncodeOnGen @Int arbitrary shrink--- prop> neverFailsToEncodeOnGen @Int genUnchecked shrinkUnchecked -- prop> neverFailsToEncodeOnGen @Int genValid shrinkValid+-- prop> neverFailsToEncodeOnGen @Int genValid shrinkValid neverFailsToEncodeOnGen :: (Show a, ToJSON a) => Gen a -> (a -> [a]) -> Property neverFailsToEncodeOnGen gen s = forAllShrink gen s $ \(a :: a) ->@@ -113,10 +101,10 @@ -- | -- -- prop> encodeAndDecodeAreInversesOnGen @Bool arbitrary shrink--- prop> encodeAndDecodeAreInversesOnGen @Bool genUnchecked shrinkUnchecked -- prop> encodeAndDecodeAreInversesOnGen @Bool genValid shrinkValid+-- prop> encodeAndDecodeAreInversesOnGen @Bool genValid shrinkValid -- prop> encodeAndDecodeAreInversesOnGen @Int arbitrary shrink--- prop> encodeAndDecodeAreInversesOnGen @Int genUnchecked shrinkUnchecked+-- prop> encodeAndDecodeAreInversesOnGen @Int genValid shrinkValid -- prop> encodeAndDecodeAreInversesOnGen @Int genValid shrinkValid encodeAndDecodeAreInversesOnGen :: (Show a, Eq a, FromJSON a, ToJSON a) => Gen a -> (a -> [a]) -> Property
test/Test/Syd/Validity/AesonSpec.hs view
@@ -17,11 +17,11 @@ spec = do jsonSpecOnGen (genListOf $ pure 'a') "sequence of 'a's" (const []) -- jsonSpec @Double DOES NOT HOLD- jsonSpecOnValid @Rational+ jsonSpec @Rational jsonSpec @Int jsonSpecOnArbitrary @Int- jsonSpecOnValid @ForShow- jsonSpecOnValid @Value+ jsonSpec @ForShow+ jsonSpec @Value -- shrinkValidSpec @Value