aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml/marshal_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/xml/marshal_test.go')
-rw-r--r--src/encoding/xml/marshal_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/encoding/xml/marshal_test.go b/src/encoding/xml/marshal_test.go
index 774793a6c5..f6bcc7fd30 100644
--- a/src/encoding/xml/marshal_test.go
+++ b/src/encoding/xml/marshal_test.go
@@ -1894,13 +1894,13 @@ func TestMarshalWriteIOErrors(t *testing.T) {
}
func TestMarshalFlush(t *testing.T) {
- var buf bytes.Buffer
+ var buf strings.Builder
enc := NewEncoder(&buf)
if err := enc.EncodeToken(CharData("hello world")); err != nil {
t.Fatalf("enc.EncodeToken: %v", err)
}
if buf.Len() > 0 {
- t.Fatalf("enc.EncodeToken caused actual write: %q", buf.Bytes())
+ t.Fatalf("enc.EncodeToken caused actual write: %q", buf.String())
}
if err := enc.Flush(); err != nil {
t.Fatalf("enc.Flush: %v", err)
@@ -2317,7 +2317,7 @@ var encodeTokenTests = []struct {
func TestEncodeToken(t *testing.T) {
loop:
for i, tt := range encodeTokenTests {
- var buf bytes.Buffer
+ var buf strings.Builder
enc := NewEncoder(&buf)
var err error
for j, tok := range tt.toks {
@@ -2437,7 +2437,7 @@ func TestIsValidDirective(t *testing.T) {
// Issue 11719. EncodeToken used to silently eat tokens with an invalid type.
func TestSimpleUseOfEncodeToken(t *testing.T) {
- var buf bytes.Buffer
+ var buf strings.Builder
enc := NewEncoder(&buf)
if err := enc.EncodeToken(&StartElement{Name: Name{"", "object1"}}); err == nil {
t.Errorf("enc.EncodeToken: pointer type should be rejected")