mirror of
https://github.com/golang/go
synced 2024-11-18 14:54:40 -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:
parent
b53471a655
commit
82d1019c60
@ -6,12 +6,12 @@ package textproto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPrintfLine(t *testing.T) {
|
func TestPrintfLine(t *testing.T) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
w := NewWriter(bufio.NewWriter(&buf))
|
w := NewWriter(bufio.NewWriter(&buf))
|
||||||
err := w.PrintfLine("foo %d", 123)
|
err := w.PrintfLine("foo %d", 123)
|
||||||
if s := buf.String(); s != "foo 123\r\n" || err != nil {
|
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) {
|
func TestDotWriter(t *testing.T) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
w := NewWriter(bufio.NewWriter(&buf))
|
w := NewWriter(bufio.NewWriter(&buf))
|
||||||
d := w.DotWriter()
|
d := w.DotWriter()
|
||||||
n, err := d.Write([]byte("abc\n.def\n..ghi\n.jkl\n."))
|
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) {
|
func TestDotWriterCloseEmptyWrite(t *testing.T) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
w := NewWriter(bufio.NewWriter(&buf))
|
w := NewWriter(bufio.NewWriter(&buf))
|
||||||
d := w.DotWriter()
|
d := w.DotWriter()
|
||||||
n, err := d.Write([]byte{})
|
n, err := d.Write([]byte{})
|
||||||
@ -50,7 +50,7 @@ func TestDotWriterCloseEmptyWrite(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDotWriterCloseNoWrite(t *testing.T) {
|
func TestDotWriterCloseNoWrite(t *testing.T) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
w := NewWriter(bufio.NewWriter(&buf))
|
w := NewWriter(bufio.NewWriter(&buf))
|
||||||
d := w.DotWriter()
|
d := w.DotWriter()
|
||||||
d.Close()
|
d.Close()
|
||||||
|
Loading…
Reference in New Issue
Block a user