1
0
mirror of https://github.com/golang/go synced 2024-11-24 04:40:24 -07:00

net/textproto: use strings.Builder

Change-Id: I2ed993a804dd830b9ff445c467eb224b7aaa3401
Reviewed-on: https://go-review.googlesource.com/c/go/+/428273
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
cuiweixie 2022-09-04 18:43:28 +08:00 committed by Gopher Robot
parent b53471a655
commit 82d1019c60

View File

@ -6,12 +6,12 @@ package textproto
import (
"bufio"
"bytes"
"strings"
"testing"
)
func TestPrintfLine(t *testing.T) {
var buf bytes.Buffer
var buf strings.Builder
w := NewWriter(bufio.NewWriter(&buf))
err := w.PrintfLine("foo %d", 123)
if s := buf.String(); s != "foo 123\r\n" || err != nil {
@ -20,7 +20,7 @@ func TestPrintfLine(t *testing.T) {
}
func TestDotWriter(t *testing.T) {
var buf bytes.Buffer
var buf strings.Builder
w := NewWriter(bufio.NewWriter(&buf))
d := w.DotWriter()
n, err := d.Write([]byte("abc\n.def\n..ghi\n.jkl\n."))
@ -35,7 +35,7 @@ func TestDotWriter(t *testing.T) {
}
func TestDotWriterCloseEmptyWrite(t *testing.T) {
var buf bytes.Buffer
var buf strings.Builder
w := NewWriter(bufio.NewWriter(&buf))
d := w.DotWriter()
n, err := d.Write([]byte{})
@ -50,7 +50,7 @@ func TestDotWriterCloseEmptyWrite(t *testing.T) {
}
func TestDotWriterCloseNoWrite(t *testing.T) {
var buf bytes.Buffer
var buf strings.Builder
w := NewWriter(bufio.NewWriter(&buf))
d := w.DotWriter()
d.Close()