hspec-golden-aeson 0.2.0.2 → 0.2.0.3
raw patch · 2 files changed
+31/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
hspec-golden-aeson.cabal view
@@ -1,5 +1,5 @@ name: hspec-golden-aeson-version: 0.2.0.2+version: 0.2.0.3 synopsis: Use tests to monitor changes in Aeson serialization description: Use tests to monitor changes in Aeson serialization homepage: https://github.com/plow-technologies/hspec-golden-aeson#readme@@ -43,6 +43,7 @@ Test.Types Test.Types.AlteredSelector Test.Types.BrokenSerialization+ Test.Types.MismatchedToAndFromSerialization Test.Types.NewSelector Test.Utils build-depends: base
+ test/Test/Types/MismatchedToAndFromSerialization.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE OverloadedStrings #-}+module Test.Types.MismatchedToAndFromSerialization where++import Data.Aeson+import GHC.Generics+import Test.QuickCheck+import Test.QuickCheck.Arbitrary.ADT++data Person = Person {+ name :: String+, age :: Int+} deriving (Eq,Show,Generic)++-- ToJSON and FromJSON use different strings, this should break.+instance ToJSON Person where+ toJSON (Person name age) = object [+ "personName" .= name+ , "personAge" .= age+ ]++instance FromJSON Person where+ parseJSON = withObject "Expected a Person object" $ \o ->+ Person <$> o .: "name"+ <*> o .: "age"++instance ToADTArbitrary Person+instance Arbitrary Person where+ arbitrary = genericArbitrary