瀏覽代碼

internal/netreflect: more use of internal/nettest package

Change-Id: I4473e69bbb445ab27554f2dc625d0cbd79d7cfe5
Reviewed-on: https://go-review.googlesource.com/35072
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Mikio Hara 9 年之前
父節點
當前提交
60c41d1de8
共有 1 個文件被更改,包括 2 次插入17 次删除
  1. 2 17
      internal/netreflect/socket_test.go

+ 2 - 17
internal/netreflect/socket_test.go

@@ -7,7 +7,6 @@ package netreflect_test
 import (
 	"net"
 	"os"
-	"runtime"
 	"testing"
 
 	"golang.org/x/net/internal/netreflect"
@@ -16,17 +15,8 @@ import (
 
 func TestSocketOf(t *testing.T) {
 	for _, network := range []string{"tcp", "unix", "unixpacket"} {
-		switch runtime.GOOS {
-		case "darwin":
-			if network == "unixpacket" {
-				continue
-			}
-		case "nacl", "plan9":
+		if !nettest.TestableNetwork(network) {
 			continue
-		case "windows":
-			if network == "unix" || network == "unixpacket" {
-				continue
-			}
 		}
 		ln, err := nettest.NewLocalListener(network)
 		if err != nil {
@@ -55,13 +45,8 @@ func TestSocketOf(t *testing.T) {
 
 func TestPacketSocketOf(t *testing.T) {
 	for _, network := range []string{"udp", "unixgram"} {
-		switch runtime.GOOS {
-		case "nacl", "plan9":
+		if !nettest.TestableNetwork(network) {
 			continue
-		case "windows":
-			if network == "unixgram" {
-				continue
-			}
 		}
 		c, err := nettest.NewLocalPacketListener(network)
 		if err != nil {