...
Source file
src/net/error_posix_test.go
Documentation: net
1
2
3
4
5
6
7
8 package net
9
10 import (
11 "os"
12 "syscall"
13 "testing"
14 )
15
16 func TestSpuriousENOTAVAIL(t *testing.T) {
17 for _, tt := range []struct {
18 error
19 ok bool
20 }{
21 {syscall.EADDRNOTAVAIL, true},
22 {&os.SyscallError{Syscall: "syscall", Err: syscall.EADDRNOTAVAIL}, true},
23 {&OpError{Op: "op", Err: syscall.EADDRNOTAVAIL}, true},
24 {&OpError{Op: "op", Err: &os.SyscallError{Syscall: "syscall", Err: syscall.EADDRNOTAVAIL}}, true},
25
26 {syscall.EINVAL, false},
27 {&os.SyscallError{Syscall: "syscall", Err: syscall.EINVAL}, false},
28 {&OpError{Op: "op", Err: syscall.EINVAL}, false},
29 {&OpError{Op: "op", Err: &os.SyscallError{Syscall: "syscall", Err: syscall.EINVAL}}, false},
30 } {
31 if ok := spuriousENOTAVAIL(tt.error); ok != tt.ok {
32 t.Errorf("spuriousENOTAVAIL(%v) = %v; want %v", tt.error, ok, tt.ok)
33 }
34 }
35 }
36
View as plain text