diff options
Diffstat (limited to 'src/encoding/xml/marshal_test.go')
| -rw-r--r-- | src/encoding/xml/marshal_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/encoding/xml/marshal_test.go b/src/encoding/xml/marshal_test.go index 6085ddbba2..d2e5137afd 100644 --- a/src/encoding/xml/marshal_test.go +++ b/src/encoding/xml/marshal_test.go @@ -309,6 +309,11 @@ type ChardataEmptyTest struct { Contents *string `xml:",chardata"` } +type PointerAnonFields struct { + *MyInt + *NamedType +} + type MyMarshalerTest struct { } @@ -889,6 +894,18 @@ var marshalTests = []struct { `</EmbedA>`, }, + // Anonymous struct pointer field which is nil + { + Value: &EmbedB{}, + ExpectXML: `<EmbedB><FieldB></FieldB></EmbedB>`, + }, + + // Other kinds of nil anonymous fields + { + Value: &PointerAnonFields{}, + ExpectXML: `<PointerAnonFields></PointerAnonFields>`, + }, + // Test that name casing matters { Value: &NameCasing{Xy: "mixed", XY: "upper", XyA: "mixedA", XYA: "upperA"}, |
