1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
15 func TestSpuriousENOTAVAIL(t
*testing
.T
) {
16 for _
, tt
:= range []struct {
20 {syscall
.EADDRNOTAVAIL
, true},
21 {&os
.SyscallError
{Syscall
: "syscall", Err
: syscall
.EADDRNOTAVAIL
}, true},
22 {&OpError
{Op
: "op", Err
: syscall
.EADDRNOTAVAIL
}, true},
23 {&OpError
{Op
: "op", Err
: &os
.SyscallError
{Syscall
: "syscall", Err
: syscall
.EADDRNOTAVAIL
}}, true},
25 {syscall
.EINVAL
, false},
26 {&os
.SyscallError
{Syscall
: "syscall", Err
: syscall
.EINVAL
}, false},
27 {&OpError
{Op
: "op", Err
: syscall
.EINVAL
}, false},
28 {&OpError
{Op
: "op", Err
: &os
.SyscallError
{Syscall
: "syscall", Err
: syscall
.EINVAL
}}, false},
30 if ok
:= spuriousENOTAVAIL(tt
.error
); ok
!= tt
.ok
{
31 t
.Errorf("spuriousENOTAVAIL(%v) = %v; want %v", tt
.error
, ok
, tt
.ok
)