Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(133)

Side by Side Diff: src/pkg/net/unix_test.go

Issue 7429049: code review 7429049: net: fix windows build (Closed)
Patch Set: diff -r 2e9e27f95e17 https://code.google.com/p/go Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/net/protoconn_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Go Authors. All rights reserved. 1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build !plan9,!windows 5 // +build !plan9,!windows
6 6
7 package net 7 package net
8 8
9 import ( 9 import (
10 "bytes" 10 "bytes"
11 "io/ioutil"
12 "os" 11 "os"
13 "reflect" 12 "reflect"
14 "runtime" 13 "runtime"
15 "syscall" 14 "syscall"
16 "testing" 15 "testing"
17 "time" 16 "time"
18 ) 17 )
19 18
20 // testUnixAddr uses ioutil.TempFile to get a name that is unique.
21 func testUnixAddr() string {
22 f, err := ioutil.TempFile("", "nettest")
23 if err != nil {
24 panic(err)
25 }
26 addr := f.Name()
27 f.Close()
28 os.Remove(addr)
29 return addr
30 }
31
32 func TestReadUnixgramWithUnnamedSocket(t *testing.T) { 19 func TestReadUnixgramWithUnnamedSocket(t *testing.T) {
33 addr := testUnixAddr() 20 addr := testUnixAddr()
34 la, err := ResolveUnixAddr("unixgram", addr) 21 la, err := ResolveUnixAddr("unixgram", addr)
35 if err != nil { 22 if err != nil {
36 t.Fatalf("ResolveUnixAddr failed: %v", err) 23 t.Fatalf("ResolveUnixAddr failed: %v", err)
37 } 24 }
38 c, err := ListenUnixgram("unixgram", la) 25 c, err := ListenUnixgram("unixgram", la)
39 if err != nil { 26 if err != nil {
40 t.Fatalf("ListenUnixgram failed: %v", err) 27 t.Fatalf("ListenUnixgram failed: %v", err)
41 } 28 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 c2, err := DialUnix("unixgram", nil, autoAddr) 135 c2, err := DialUnix("unixgram", nil, autoAddr)
149 if err != nil { 136 if err != nil {
150 t.Fatalf("DialUnix failed: %v", err) 137 t.Fatalf("DialUnix failed: %v", err)
151 } 138 }
152 defer c2.Close() 139 defer c2.Close()
153 140
154 if !reflect.DeepEqual(c1.LocalAddr(), c2.RemoteAddr()) { 141 if !reflect.DeepEqual(c1.LocalAddr(), c2.RemoteAddr()) {
155 t.Fatalf("Expected autobind address %v, got %v", c1.LocalAddr(), c2.RemoteAddr()) 142 t.Fatalf("Expected autobind address %v, got %v", c1.LocalAddr(), c2.RemoteAddr())
156 } 143 }
157 } 144 }
OLDNEW
« no previous file with comments | « src/pkg/net/protoconn_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b