aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-10-12 16:50:35 -0700
committerKeith Randall <khr@golang.org>2021-11-09 21:26:25 +0000
commitb93220c9ca1935c56c01afc1d72d063f1e026f15 (patch)
tree82dae0a1a09225a7b901d403777fd5c7097b2f2d /src/encoding/xml
parentf981a9f7ded779749dca199e0893aa08529b52ec (diff)
downloadgo-b93220c9ca1935c56c01afc1d72d063f1e026f15.tar.xz
encoding/xml: add generic encoding test
Fixes #48521 Change-Id: Id8402bcff243c0ab19e4ec0b138b9af8c111f88d Reviewed-on: https://go-review.googlesource.com/c/go/+/355492 Trust: Keith Randall <khr@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/encoding/xml')
-rw-r--r--src/encoding/xml/marshal_test.go5
1 files changed, 5 insertions, 0 deletions
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: `<particle>true</particle>`},
{Value: &Departure{When: ParseTime("2013-01-09T00:15:00-09:00")}, ExpectXML: `<departure>2013-01-09T00:15:00-09:00</departure>`},
{Value: atomValue, ExpectXML: atomXML},
+ {Value: &Generic[int]{1}, ExpectXML: `<Generic><X>1</X></Generic>`},
{
Value: &Ship{
Name: "Heart of Gold",