diff options
Diffstat (limited to 'libgo/go/encoding/xml/read_test.go')
-rw-r--r-- | libgo/go/encoding/xml/read_test.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libgo/go/encoding/xml/read_test.go b/libgo/go/encoding/xml/read_test.go index 7a98092803..273c303d16 100644 --- a/libgo/go/encoding/xml/read_test.go +++ b/libgo/go/encoding/xml/read_test.go @@ -705,7 +705,7 @@ func TestUnmarshalIntoInterface(t *testing.T) { } pea, ok := pod.Pea.(*Pea) if !ok { - t.Fatalf("unmarshalled into wrong type: have %T want *Pea", pod.Pea) + t.Fatalf("unmarshaled into wrong type: have %T want *Pea", pod.Pea) } have, want := pea.Cotelydon, "Green stuff" if have != want { @@ -733,3 +733,22 @@ func TestMalformedComment(t *testing.T) { } } } + +type IXField struct { + Five int `xml:"five"` + NotInnerXML []string `xml:",innerxml"` +} + +// Issue 15600. ",innerxml" on a field that can't hold it. +func TestInvalidInnerXMLType(t *testing.T) { + v := new(IXField) + if err := Unmarshal([]byte(`<tag><five>5</five><innertag/></tag>`), v); err != nil { + t.Errorf("Unmarshal failed: got %v", err) + } + if v.Five != 5 { + t.Errorf("Five = %v, want 5", v.Five) + } + if v.NotInnerXML != nil { + t.Errorf("NotInnerXML = %v, want nil", v.NotInnerXML) + } +} |