From: Mikio Hara Date: Tue, 20 Mar 2012 01:57:54 +0000 (+0900) Subject: net: drop unnecessary type assertions and fix leak in test X-Git-Tag: weekly.2012-03-22~41 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7905faaee2ee5ebd628856b05f22b9e1264b7b92;p=gostls13.git net: drop unnecessary type assertions and fix leak in test R=golang-dev, r CC=golang-dev https://golang.org/cl/5847064 --- diff --git a/src/pkg/net/unicast_test.go b/src/pkg/net/unicast_test.go index a23bc5adaf..e5dd013db6 100644 --- a/src/pkg/net/unicast_test.go +++ b/src/pkg/net/unicast_test.go @@ -5,7 +5,6 @@ package net import ( - "io" "runtime" "syscall" "testing" @@ -67,7 +66,7 @@ func TestTCPListener(t *testing.T) { case syscall.AF_INET6: testIPv6UnicastSocketOptions(t, fd) } - l1.(io.Closer).Close() + l1.Close() } } @@ -112,7 +111,7 @@ func TestUDPListener(t *testing.T) { case syscall.AF_INET6: testIPv6UnicastSocketOptions(t, fd) } - l1.(io.Closer).Close() + l1.Close() } } @@ -134,7 +133,7 @@ func TestSimpleTCPListener(t *testing.T) { checkFirstListener(t, tt.net, tt.laddr+":"+port, l1) l2, err := Listen(tt.net, tt.laddr+":"+port) checkSecondListener(t, tt.net, tt.laddr+":"+port, err, l2) - l1.(io.Closer).Close() + l1.Close() } } @@ -169,7 +168,7 @@ func TestSimpleUDPListener(t *testing.T) { checkFirstListener(t, tt.net, tt.laddr+":"+port, l1) l2, err := ListenPacket(tt.net, tt.laddr+":"+port) checkSecondListener(t, tt.net, tt.laddr+":"+port, err, l2) - l1.(io.Closer).Close() + l1.Close() } } @@ -530,8 +529,9 @@ func TestProhibitionaryDialArgs(t *testing.T) { defer l.Close() for _, tt := range prohibitionaryDialArgTests { - _, err := Dial(tt.net, tt.addr+":"+port) + c, err := Dial(tt.net, tt.addr+":"+port) if err == nil { + c.Close() t.Fatalf("Dial(%q, %q) should fail", tt.net, tt.addr) } }