]> Cypherpunks repositories - gostls13.git/commitdiff
net: drop unnecessary type assertions and fix leak in test
authorMikio Hara <mikioh.mikioh@gmail.com>
Tue, 20 Mar 2012 01:57:54 +0000 (10:57 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Tue, 20 Mar 2012 01:57:54 +0000 (10:57 +0900)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5847064

src/pkg/net/unicast_test.go

index a23bc5adaf28dceb89793df354554ee0f1060531..e5dd013db670c9985419194ea38ee11acd7681d8 100644 (file)
@@ -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)
                }
        }