1
0
mirror of https://github.com/golang/go synced 2024-11-25 12:47:56 -07:00

net: minor fixes to test

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5707058
This commit is contained in:
Mikio Hara 2012-02-29 12:34:05 +09:00
parent ee149d9a6b
commit ecdd9f2376
2 changed files with 6 additions and 6 deletions

View File

@ -186,7 +186,7 @@ var duplicateErrorPattern = `dial (.*) dial (.*)`
func TestDialError(t *testing.T) { func TestDialError(t *testing.T) {
if !*runErrorTest { if !*runErrorTest {
t.Logf("test disabled; use --run_error_test to enable") t.Logf("test disabled; use -run_error_test to enable")
return return
} }
for i, tt := range dialErrorTests { for i, tt := range dialErrorTests {

View File

@ -38,18 +38,18 @@ func testWriteToConn(t *testing.T, raddr string) {
_, err = c.(*UDPConn).WriteToUDP([]byte("Connection-oriented mode socket"), ra) _, err = c.(*UDPConn).WriteToUDP([]byte("Connection-oriented mode socket"), ra)
if err == nil { if err == nil {
t.Fatal("WriteToUDP should be failed") t.Fatal("WriteToUDP should fail")
} }
if err != nil && err.(*OpError).Err != ErrWriteToConnected { if err != nil && err.(*OpError).Err != ErrWriteToConnected {
t.Fatalf("WriteToUDP should be failed as ErrWriteToConnected: %v", err) t.Fatalf("WriteToUDP should fail as ErrWriteToConnected: %v", err)
} }
_, err = c.(*UDPConn).WriteTo([]byte("Connection-oriented mode socket"), ra) _, err = c.(*UDPConn).WriteTo([]byte("Connection-oriented mode socket"), ra)
if err == nil { if err == nil {
t.Fatal("WriteTo should be failed") t.Fatal("WriteTo should fail")
} }
if err != nil && err.(*OpError).Err != ErrWriteToConnected { if err != nil && err.(*OpError).Err != ErrWriteToConnected {
t.Fatalf("WriteTo should be failed as ErrWriteToConnected: %v", err) t.Fatalf("WriteTo should fail as ErrWriteToConnected: %v", err)
} }
_, err = c.Write([]byte("Connection-oriented mode socket")) _, err = c.Write([]byte("Connection-oriented mode socket"))
@ -82,6 +82,6 @@ func testWriteToPacketConn(t *testing.T, raddr string) {
_, err = c.(*UDPConn).Write([]byte("Connection-less mode socket")) _, err = c.(*UDPConn).Write([]byte("Connection-less mode socket"))
if err == nil { if err == nil {
t.Fatal("Write should be failed") t.Fatal("Write should fail")
} }
} }