summaryrefslogtreecommitdiff
path: root/src/pkg/xml/xml_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/xml/xml_test.go')
-rw-r--r--src/pkg/xml/xml_test.go75
1 files changed, 38 insertions, 37 deletions
diff --git a/src/pkg/xml/xml_test.go b/src/pkg/xml/xml_test.go
index 47a3db1e8..2bd084fd8 100644
--- a/src/pkg/xml/xml_test.go
+++ b/src/pkg/xml/xml_test.go
@@ -9,7 +9,6 @@ import (
"io"
"os"
"reflect"
- "strings"
"testing"
)
@@ -30,69 +29,71 @@ const testInput = `
</body><!-- missing final newline -->`
var rawTokens = []Token{
- CharData(strings.Bytes("\n")),
- ProcInst{"xml", strings.Bytes(`version="1.0" encoding="UTF-8"`)},
- CharData(strings.Bytes("\n")),
- Directive(strings.Bytes(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`)),
- CharData(strings.Bytes("\n")),
+ CharData([]byte("\n")),
+ ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)},
+ CharData([]byte("\n")),
+ Directive([]byte(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`),
+ ),
+ CharData([]byte("\n")),
StartElement{Name{"", "body"}, []Attr{Attr{Name{"xmlns", "foo"}, "ns1"}, Attr{Name{"", "xmlns"}, "ns2"}, Attr{Name{"xmlns", "tag"}, "ns3"}}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"", "hello"}, []Attr{Attr{Name{"", "lang"}, "en"}}},
- CharData(strings.Bytes("World <>'\" 白鵬翔")),
+ CharData([]byte("World <>'\" 白鵬翔")),
EndElement{Name{"", "hello"}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"", "goodbye"}, nil},
EndElement{Name{"", "goodbye"}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"", "outer"}, []Attr{Attr{Name{"foo", "attr"}, "value"}, Attr{Name{"xmlns", "tag"}, "ns4"}}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"", "inner"}, nil},
EndElement{Name{"", "inner"}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
EndElement{Name{"", "outer"}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"tag", "name"}, nil},
- CharData(strings.Bytes("\n ")),
- CharData(strings.Bytes("Some text here.")),
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
+ CharData([]byte("Some text here.")),
+ CharData([]byte("\n ")),
EndElement{Name{"tag", "name"}},
- CharData(strings.Bytes("\n")),
+ CharData([]byte("\n")),
EndElement{Name{"", "body"}},
- Comment(strings.Bytes(" missing final newline ")),
+ Comment([]byte(" missing final newline ")),
}
var cookedTokens = []Token{
- CharData(strings.Bytes("\n")),
- ProcInst{"xml", strings.Bytes(`version="1.0" encoding="UTF-8"`)},
- CharData(strings.Bytes("\n")),
- Directive(strings.Bytes(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`)),
- CharData(strings.Bytes("\n")),
+ CharData([]byte("\n")),
+ ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)},
+ CharData([]byte("\n")),
+ Directive([]byte(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`),
+ ),
+ CharData([]byte("\n")),
StartElement{Name{"ns2", "body"}, []Attr{Attr{Name{"xmlns", "foo"}, "ns1"}, Attr{Name{"", "xmlns"}, "ns2"}, Attr{Name{"xmlns", "tag"}, "ns3"}}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"ns2", "hello"}, []Attr{Attr{Name{"", "lang"}, "en"}}},
- CharData(strings.Bytes("World <>'\" 白鵬翔")),
+ CharData([]byte("World <>'\" 白鵬翔")),
EndElement{Name{"ns2", "hello"}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"ns2", "goodbye"}, nil},
EndElement{Name{"ns2", "goodbye"}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"ns2", "outer"}, []Attr{Attr{Name{"ns1", "attr"}, "value"}, Attr{Name{"xmlns", "tag"}, "ns4"}}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"ns2", "inner"}, nil},
EndElement{Name{"ns2", "inner"}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
EndElement{Name{"ns2", "outer"}},
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
StartElement{Name{"ns3", "name"}, nil},
- CharData(strings.Bytes("\n ")),
- CharData(strings.Bytes("Some text here.")),
- CharData(strings.Bytes("\n ")),
+ CharData([]byte("\n ")),
+ CharData([]byte("Some text here.")),
+ CharData([]byte("\n ")),
EndElement{Name{"ns3", "name"}},
- CharData(strings.Bytes("\n")),
+ CharData([]byte("\n")),
EndElement{Name{"ns2", "body"}},
- Comment(strings.Bytes(" missing final newline ")),
+ Comment([]byte(" missing final newline ")),
}
var xmlInput = []string{