Commit 541bf9f8 authored by Mikio Hara's avatar Mikio Hara Committed by Brad Fitzpatrick

net/smtp: don't call testing.T.Fatal{,f} from goroutines not running Test function

Also replaces verbs for error message from %s to %v. In general, low
level IO APIs return an error value containing non-string types and
there's no guarantee that all the types implement fmt.Stringer
interface.

Change-Id: I8a6e2a80d5c721c772a83b9556bac16556eaa771
Reviewed-on: https://go-review.googlesource.com/73931
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 0b7df655
......@@ -385,21 +385,21 @@ func TestNewClientWithTLS(t *testing.T) {
if err != nil {
ln, err = tls.Listen("tcp", "[::1]:0", &config)
if err != nil {
t.Fatalf("server: listen: %s", err)
t.Fatalf("server: listen: %v", err)
}
}
go func() {
conn, err := ln.Accept()
if err != nil {
t.Fatalf("server: accept: %s", err)
t.Errorf("server: accept: %v", err)
return
}
defer conn.Close()
_, err = conn.Write([]byte("220 SIGNS\r\n"))
if err != nil {
t.Fatalf("server: write: %s", err)
t.Errorf("server: write: %v", err)
return
}
}()
......@@ -407,13 +407,13 @@ func TestNewClientWithTLS(t *testing.T) {
config.InsecureSkipVerify = true
conn, err := tls.Dial("tcp", ln.Addr().String(), &config)
if err != nil {
t.Fatalf("client: dial: %s", err)
t.Fatalf("client: dial: %v", err)
}
defer conn.Close()
client, err := NewClient(conn, ln.Addr().String())
if err != nil {
t.Fatalf("smtp: newclient: %s", err)
t.Fatalf("smtp: newclient: %v", err)
}
if !client.tls {
t.Errorf("client.tls Got: %t Expected: %t", client.tls, true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment