mirror of
https://github.com/golang/go
synced 2024-11-24 05:10:19 -07:00
net/smtp: use strings.Builder
Change-Id: I0d1195fcb4eceb12c4be3190b05a82079dc496a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/428272 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: 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
6a2ff105f1
commit
e2d8ed2fd7
@ -113,7 +113,7 @@ func TestAuthPlain(t *testing.T) {
|
|||||||
func TestClientAuthTrimSpace(t *testing.T) {
|
func TestClientAuthTrimSpace(t *testing.T) {
|
||||||
server := "220 hello world\r\n" +
|
server := "220 hello world\r\n" +
|
||||||
"200 some more"
|
"200 some more"
|
||||||
var wrote bytes.Buffer
|
var wrote strings.Builder
|
||||||
var fake faker
|
var fake faker
|
||||||
fake.ReadWriter = struct {
|
fake.ReadWriter = struct {
|
||||||
io.Reader
|
io.Reader
|
||||||
@ -164,7 +164,7 @@ func TestBasic(t *testing.T) {
|
|||||||
server := strings.Join(strings.Split(basicServer, "\n"), "\r\n")
|
server := strings.Join(strings.Split(basicServer, "\n"), "\r\n")
|
||||||
client := strings.Join(strings.Split(basicClient, "\n"), "\r\n")
|
client := strings.Join(strings.Split(basicClient, "\n"), "\r\n")
|
||||||
|
|
||||||
var cmdbuf bytes.Buffer
|
var cmdbuf strings.Builder
|
||||||
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
||||||
var fake faker
|
var fake faker
|
||||||
fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
|
fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
|
||||||
@ -505,7 +505,7 @@ func TestNewClient(t *testing.T) {
|
|||||||
server := strings.Join(strings.Split(newClientServer, "\n"), "\r\n")
|
server := strings.Join(strings.Split(newClientServer, "\n"), "\r\n")
|
||||||
client := strings.Join(strings.Split(newClientClient, "\n"), "\r\n")
|
client := strings.Join(strings.Split(newClientClient, "\n"), "\r\n")
|
||||||
|
|
||||||
var cmdbuf bytes.Buffer
|
var cmdbuf strings.Builder
|
||||||
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
||||||
out := func() string {
|
out := func() string {
|
||||||
bcmdbuf.Flush()
|
bcmdbuf.Flush()
|
||||||
@ -550,7 +550,7 @@ func TestNewClient2(t *testing.T) {
|
|||||||
server := strings.Join(strings.Split(newClient2Server, "\n"), "\r\n")
|
server := strings.Join(strings.Split(newClient2Server, "\n"), "\r\n")
|
||||||
client := strings.Join(strings.Split(newClient2Client, "\n"), "\r\n")
|
client := strings.Join(strings.Split(newClient2Client, "\n"), "\r\n")
|
||||||
|
|
||||||
var cmdbuf bytes.Buffer
|
var cmdbuf strings.Builder
|
||||||
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
||||||
var fake faker
|
var fake faker
|
||||||
fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
|
fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
|
||||||
@ -643,7 +643,7 @@ func TestHello(t *testing.T) {
|
|||||||
for i := 0; i < len(helloServer); i++ {
|
for i := 0; i < len(helloServer); i++ {
|
||||||
server := strings.Join(strings.Split(baseHelloServer+helloServer[i], "\n"), "\r\n")
|
server := strings.Join(strings.Split(baseHelloServer+helloServer[i], "\n"), "\r\n")
|
||||||
client := strings.Join(strings.Split(baseHelloClient+helloClient[i], "\n"), "\r\n")
|
client := strings.Join(strings.Split(baseHelloClient+helloClient[i], "\n"), "\r\n")
|
||||||
var cmdbuf bytes.Buffer
|
var cmdbuf strings.Builder
|
||||||
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
||||||
var fake faker
|
var fake faker
|
||||||
fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
|
fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
|
||||||
@ -749,7 +749,7 @@ var helloClient = []string{
|
|||||||
func TestSendMail(t *testing.T) {
|
func TestSendMail(t *testing.T) {
|
||||||
server := strings.Join(strings.Split(sendMailServer, "\n"), "\r\n")
|
server := strings.Join(strings.Split(sendMailServer, "\n"), "\r\n")
|
||||||
client := strings.Join(strings.Split(sendMailClient, "\n"), "\r\n")
|
client := strings.Join(strings.Split(sendMailClient, "\n"), "\r\n")
|
||||||
var cmdbuf bytes.Buffer
|
var cmdbuf strings.Builder
|
||||||
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
||||||
l, err := net.Listen("tcp", "127.0.0.1:0")
|
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -906,7 +906,7 @@ SendMail is working for me.
|
|||||||
func TestAuthFailed(t *testing.T) {
|
func TestAuthFailed(t *testing.T) {
|
||||||
server := strings.Join(strings.Split(authFailedServer, "\n"), "\r\n")
|
server := strings.Join(strings.Split(authFailedServer, "\n"), "\r\n")
|
||||||
client := strings.Join(strings.Split(authFailedClient, "\n"), "\r\n")
|
client := strings.Join(strings.Split(authFailedClient, "\n"), "\r\n")
|
||||||
var cmdbuf bytes.Buffer
|
var cmdbuf strings.Builder
|
||||||
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
bcmdbuf := bufio.NewWriter(&cmdbuf)
|
||||||
var fake faker
|
var fake faker
|
||||||
fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
|
fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
|
||||||
|
Loading…
Reference in New Issue
Block a user