From b93220c9ca1935c56c01afc1d72d063f1e026f15 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 12 Oct 2021 16:50:35 -0700 Subject: [PATCH] encoding/xml: add generic encoding test Fixes #48521 Change-Id: Id8402bcff243c0ab19e4ec0b138b9af8c111f88d Reviewed-on: https://go-review.googlesource.com/c/go/+/355492 Trust: Keith Randall Trust: Dan Scales Run-TryBot: Keith Randall TryBot-Result: Go Bot Reviewed-by: Dan Scales --- src/encoding/xml/marshal_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/encoding/xml/marshal_test.go b/src/encoding/xml/marshal_test.go index d2e5137afd..cb95905f5b 100644 --- a/src/encoding/xml/marshal_test.go +++ b/src/encoding/xml/marshal_test.go @@ -524,6 +524,10 @@ type IfaceAny struct { T2 T2 } +type Generic[T any] struct { + X T +} + var ( nameAttr = "Sarah" ageAttr = uint(12) @@ -641,6 +645,7 @@ var marshalTests = []struct { {Value: &Particle{HasMass: true}, ExpectXML: `true`}, {Value: &Departure{When: ParseTime("2013-01-09T00:15:00-09:00")}, ExpectXML: `2013-01-09T00:15:00-09:00`}, {Value: atomValue, ExpectXML: atomXML}, + {Value: &Generic[int]{1}, ExpectXML: `1`}, { Value: &Ship{ Name: "Heart of Gold", -- 2.50.0