libgo: update to Go 1.11
[official-gcc.git] / libgo / go / net / error_posix_test.go
blobb411a378dfc70045e02d001aea4a57e886ce72a9
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.
5 // +build !plan9
7 package net
9 import (
10 "os"
11 "syscall"
12 "testing"
15 func TestSpuriousENOTAVAIL(t *testing.T) {
16 for _, tt := range []struct {
17 error
18 ok bool
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},
29 } {
30 if ok := spuriousENOTAVAIL(tt.error); ok != tt.ok {
31 t.Errorf("spuriousENOTAVAIL(%v) = %v; want %v", tt.error, ok, tt.ok)