mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
encoding/xml: fix copy bug
Fixes #2484. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5417059
This commit is contained in:
parent
6e3e380923
commit
fe838c2ddb
2 changed files with 5 additions and 2 deletions
|
|
@ -486,10 +486,13 @@ func TestCopyTokenStartElement(t *testing.T) {
|
|||
elt := StartElement{Name{"", "hello"}, []Attr{{Name{"", "lang"}, "en"}}}
|
||||
var tok1 Token = elt
|
||||
tok2 := CopyToken(tok1)
|
||||
if tok1.(StartElement).Attr[0].Value != "en" {
|
||||
t.Error("CopyToken overwrote Attr[0]")
|
||||
}
|
||||
if !reflect.DeepEqual(tok1, tok2) {
|
||||
t.Error("CopyToken(StartElement) != StartElement")
|
||||
}
|
||||
elt.Attr[0] = Attr{Name{"", "lang"}, "de"}
|
||||
tok1.(StartElement).Attr[0] = Attr{Name{"", "lang"}, "de"}
|
||||
if reflect.DeepEqual(tok1, tok2) {
|
||||
t.Error("CopyToken(CharData) uses same buffer.")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue