From: Keith Randall Date: Tue, 12 Oct 2021 23:50:35 +0000 (-0700) Subject: encoding/xml: add generic encoding test X-Git-Tag: go1.18beta1~420 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b93220c9ca1935c56c01afc1d72d063f1e026f15;p=gostls13.git 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 --- 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",