@@ -25,6 +25,7 @@ import Data.List.NonEmpty (NonEmpty)
2525import Data.Map (Map)
2626import Data.Proxy (Proxy)
2727import Data.Ratio (Ratio)
28+import Data.Semigroup (Option(..))
2829import Data.Sequence (Seq)
2930import Data.Tagged (Tagged)
3031import Data.Time (Day, DiffTime, LocalTime, NominalDiffTime, TimeOfDay, UTCTime, ZonedTime)
@@ -376,6 +377,11 @@ tests = testGroup "properties" [
376377 , testProperty "Tagged" (toParseJSON gOneConstructorParseJSONTagged gOneConstructorToJSONTagged)
377378 ]
378379 ]
380+ , testGroup "OptionField" [
381+ testProperty "like Maybe" $
382+ \x -> gOptionFieldToJSON (OptionField (Option x)) === thMaybeFieldToJSON (MaybeField x)
383+ , testProperty "roundTrip" (toParseJSON gOptionFieldParseJSON gOptionFieldToJSON)
384+ ]
379385 ]
380386 , testGroup "toEncoding" [
381387 testProperty "NullaryString" $
@@ -429,6 +435,9 @@ tests = testGroup "properties" [
429435 gOneConstructorToJSONDefault `sameAs` gOneConstructorToEncodingDefault
430436 , testProperty "OneConstructorTagged" $
431437 gOneConstructorToJSONTagged `sameAs` gOneConstructorToEncodingTagged
438+
439+ , testProperty "OptionField" $
440+ gOptionFieldToJSON `sameAs` gOptionFieldToEncoding
432441 ]
433442 ]
434443 , testGroup "template-haskell" [
@@ -489,6 +498,11 @@ tests = testGroup "properties" [
489498 , testProperty "Tagged" (toParseJSON thOneConstructorParseJSONTagged thOneConstructorToJSONTagged)
490499 ]
491500 ]
501+ , testGroup "OptionField" [
502+ testProperty "like Maybe" $
503+ \x -> thOptionFieldToJSON (OptionField (Option x)) === thMaybeFieldToJSON (MaybeField x)
504+ , testProperty "roundTrip" (toParseJSON thOptionFieldParseJSON thOptionFieldToJSON)
505+ ]
492506 ]
493507 , testGroup "toEncoding" [
494508 testProperty "NullaryString" $
@@ -533,6 +547,9 @@ tests = testGroup "properties" [
533547 thOneConstructorToJSONDefault `sameAs` thOneConstructorToEncodingDefault
534548 , testProperty "OneConstructorTagged" $
535549 thOneConstructorToJSONTagged `sameAs` thOneConstructorToEncodingTagged
550+
551+ , testProperty "OptionField" $
552+ thOptionFieldToJSON `sameAs` thOptionFieldToEncoding
536553 ]
537554 ]
538555 ]