Skip to content

Commit

Permalink
Add test for union in regression #172
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmil committed Aug 30, 2023
1 parent 03f0b9b commit 53f4302
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/FSharp.SystemTextJson.Tests/Test.Regression.fs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,14 @@ let ``regression #154`` () =
|> ignore

type X = { X: X }
type UY = UY of int * int
type Y = { Y: UY }

[<Fact>]
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))

0 comments on commit 53f4302

Please sign in to comment.