From 53f430282a336560fc2846a7570f1d656b447b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Denuzi=C3=A8re?= Date: Wed, 30 Aug 2023 11:49:14 +0200 Subject: [PATCH] Add test for union in regression #172 --- tests/FSharp.SystemTextJson.Tests/Test.Regression.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/FSharp.SystemTextJson.Tests/Test.Regression.fs b/tests/FSharp.SystemTextJson.Tests/Test.Regression.fs index c8b6198..2d9c9ba 100644 --- a/tests/FSharp.SystemTextJson.Tests/Test.Regression.fs +++ b/tests/FSharp.SystemTextJson.Tests/Test.Regression.fs @@ -113,10 +113,14 @@ let ``regression #154`` () = |> ignore type X = { X: X } +type UY = UY of int * int +type Y = { Y: UY } [] let ``regression #172`` () = let x = { X = Unchecked.defaultof<_> } + let y = { Y = Unchecked.defaultof<_> } let options = JsonSerializerOptions() options.Converters.Add(JsonFSharpConverter()) Assert.Equal("{\"X\":null}", JsonSerializer.Serialize(x, options)) + Assert.Equal("{\"Y\":null}", JsonSerializer.Serialize(y, options))