(t *testing.T)
| 265 | } |
| 266 | |
| 267 | func TestFdsConn(t *testing.T) { |
| 268 | socketPath, cleanup := tempSocket(t) |
| 269 | defer cleanup() |
| 270 | unix, err := net.ListenUnixgram("unixgram", &net.UnixAddr{ |
| 271 | Net: "unixgram", |
| 272 | Name: socketPath, |
| 273 | }) |
| 274 | if err != nil { |
| 275 | t.Fatal(err) |
| 276 | } |
| 277 | |
| 278 | parent := newFds(nil, nil) |
| 279 | if err := parent.AddConn("unixgram", "", unix); err != nil { |
| 280 | t.Fatal("Can't add conn:", err) |
| 281 | } |
| 282 | unix.Close() |
| 283 | |
| 284 | child := newFds(parent.copy(), nil) |
| 285 | conn, err := child.Conn("unixgram", "") |
| 286 | if err != nil { |
| 287 | t.Fatal("Can't get conn:", err) |
| 288 | } |
| 289 | if conn == nil { |
| 290 | t.Fatal("Missing conn") |
| 291 | } |
| 292 | conn.Close() |
| 293 | } |
| 294 | |
| 295 | func TestFdsFile(t *testing.T) { |
| 296 | r, w, err := os.Pipe() |
nothing calls this directly
no test coverage detected
searching dependent graphs…