summaryrefslogtreecommitdiff
path: root/src/pkg/net/net_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/net_test.go')
-rw-r--r--src/pkg/net/net_test.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/pkg/net/net_test.go b/src/pkg/net/net_test.go
index 1320096df..bfed4d657 100644
--- a/src/pkg/net/net_test.go
+++ b/src/pkg/net/net_test.go
@@ -28,12 +28,14 @@ func TestShutdown(t *testing.T) {
defer ln.Close()
c, err := ln.Accept()
if err != nil {
- t.Fatalf("Accept: %v", err)
+ t.Errorf("Accept: %v", err)
+ return
}
var buf [10]byte
n, err := c.Read(buf[:])
if n != 0 || err != io.EOF {
- t.Fatalf("server Read = %d, %v; want 0, io.EOF", n, err)
+ t.Errorf("server Read = %d, %v; want 0, io.EOF", n, err)
+ return
}
c.Write([]byte("response"))
c.Close()
@@ -62,7 +64,7 @@ func TestShutdown(t *testing.T) {
func TestShutdownUnix(t *testing.T) {
switch runtime.GOOS {
- case "windows", "plan9":
+ case "nacl", "plan9", "windows":
t.Skipf("skipping test on %q", runtime.GOOS)
}
f, err := ioutil.TempFile("", "go_net_unixtest")
@@ -84,12 +86,14 @@ func TestShutdownUnix(t *testing.T) {
go func() {
c, err := ln.Accept()
if err != nil {
- t.Fatalf("Accept: %v", err)
+ t.Errorf("Accept: %v", err)
+ return
}
var buf [10]byte
n, err := c.Read(buf[:])
if n != 0 || err != io.EOF {
- t.Fatalf("server Read = %d, %v; want 0, io.EOF", n, err)
+ t.Errorf("server Read = %d, %v; want 0, io.EOF", n, err)
+ return
}
c.Write([]byte("response"))
c.Close()
@@ -196,7 +200,8 @@ func TestTCPClose(t *testing.T) {
go func() {
c, err := Dial("tcp", l.Addr().String())
if err != nil {
- t.Fatal(err)
+ t.Errorf("Dial: %v", err)
+ return
}
go read(c)
@@ -231,12 +236,12 @@ func TestErrorNil(t *testing.T) {
// Make Listen fail by relistening on the same address.
l, err := Listen("tcp", "127.0.0.1:0")
if err != nil {
- t.Fatal("Listen 127.0.0.1:0: %v", err)
+ t.Fatalf("Listen 127.0.0.1:0: %v", err)
}
defer l.Close()
l1, err := Listen("tcp", l.Addr().String())
if err == nil {
- t.Fatal("second Listen %v: %v", l.Addr(), err)
+ t.Fatalf("second Listen %v: %v", l.Addr(), err)
}
if l1 != nil {
t.Fatalf("Listen returned non-nil interface %T(%v) with err != nil", l1, l1)
@@ -245,12 +250,12 @@ func TestErrorNil(t *testing.T) {
// Make ListenPacket fail by relistening on the same address.
lp, err := ListenPacket("udp", "127.0.0.1:0")
if err != nil {
- t.Fatal("Listen 127.0.0.1:0: %v", err)
+ t.Fatalf("Listen 127.0.0.1:0: %v", err)
}
defer lp.Close()
lp1, err := ListenPacket("udp", lp.LocalAddr().String())
if err == nil {
- t.Fatal("second Listen %v: %v", lp.LocalAddr(), err)
+ t.Fatalf("second Listen %v: %v", lp.LocalAddr(), err)
}
if lp1 != nil {
t.Fatalf("ListenPacket returned non-nil interface %T(%v) with err != nil", lp1, lp1)