Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1041 from haskell/issue-571
Add a regression test for issue #571
- Loading branch information
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{-# LANGUAGE OverloadedStrings, DeriveGeneric #-} | ||
module Regression.Issue571 (issue571) where | ||
|
||
import Test.Tasty (TestTree) | ||
import Test.Tasty.HUnit (testCase, (@?=)) | ||
import GHC.Generics (Generic) | ||
|
||
import Data.Aeson | ||
|
||
data F = F | ||
{ a :: Maybe Int | ||
, b :: Maybe Int | ||
} | ||
deriving (Eq, Show, Generic) | ||
|
||
instance FromJSON F where | ||
parseJSON = genericParseJSON defaultOptions { omitNothingFields = False } -- default | ||
|
||
issue571 :: TestTree | ||
issue571 = testCase "issue571" $ do | ||
-- the Maybe fields can be omitted. | ||
let actual = decode "{}" :: Maybe F | ||
actual @?= Just F { a = Nothing, b = Nothing } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters