File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ test-suite aeson-tests
163
163
PropertyRTFunctors
164
164
PropertyTH
165
165
PropUtils
166
+ Regression.Issue571
166
167
Regression.Issue967
167
168
SerializationFormatSpec
168
169
Types
Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE OverloadedStrings, DeriveGeneric #-}
2
+ module Regression.Issue571 (issue571 ) where
3
+
4
+ import Test.Tasty (TestTree )
5
+ import Test.Tasty.HUnit (testCase , (@?=) )
6
+ import GHC.Generics (Generic )
7
+
8
+ import Data.Aeson
9
+
10
+ data F = F
11
+ { a :: Maybe Int
12
+ , b :: Maybe Int
13
+ }
14
+ deriving (Eq , Show , Generic )
15
+
16
+ instance FromJSON F where
17
+ parseJSON = genericParseJSON defaultOptions { omitNothingFields = False } -- default
18
+
19
+ issue571 :: TestTree
20
+ issue571 = testCase " issue571" $ do
21
+ -- the Maybe fields can be omitted.
22
+ let actual = decode " {}" :: Maybe F
23
+ actual @?= Just F { a = Nothing , b = Nothing }
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ import qualified Data.Text.Lazy.Encoding as TLE
72
72
import qualified ErrorMessages
73
73
import qualified SerializationFormatSpec
74
74
import qualified Data.Map as Map -- Lazy!
75
+ import Regression.Issue571
75
76
import Regression.Issue967
76
77
77
78
roundTripCamel :: String -> Assertion
@@ -826,6 +827,7 @@ tests = testGroup "unit" [
826
827
assertEqual " " (object [" foo" .= True ]) [aesonQQ | {"foo": true } |]
827
828
]
828
829
, monadFixTests
830
+ , issue571
829
831
, issue967
830
832
, testCase " KeyMap.insertWith" $ do
831
833
KM. insertWith (-) " a" 2 (KM. fromList [(" a" , 1 )]) @?= KM. fromList [(" a" ,1 :: Int )]
You can’t perform that action at this time.
0 commit comments