internal,net,os,runtime,syscall: fixes for AIX following update to go1.9
[official-gcc.git] / libgo / go / internal / poll / fd_posix_test.go
blob246d4989e1cf83a315a626060e0a3a840dcad7a4
1 // Copyright 2012 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 aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
7 package poll_test
9 import (
10 . "internal/poll"
11 "io"
12 "testing"
15 var eofErrorTests = []struct {
16 n int
17 err error
18 fd *FD
19 expected error
21 {100, nil, &FD{ZeroReadIsEOF: true}, nil},
22 {100, io.EOF, &FD{ZeroReadIsEOF: true}, io.EOF},
23 {100, ErrNetClosing, &FD{ZeroReadIsEOF: true}, ErrNetClosing},
24 {0, nil, &FD{ZeroReadIsEOF: true}, io.EOF},
25 {0, io.EOF, &FD{ZeroReadIsEOF: true}, io.EOF},
26 {0, ErrNetClosing, &FD{ZeroReadIsEOF: true}, ErrNetClosing},
28 {100, nil, &FD{ZeroReadIsEOF: false}, nil},
29 {100, io.EOF, &FD{ZeroReadIsEOF: false}, io.EOF},
30 {100, ErrNetClosing, &FD{ZeroReadIsEOF: false}, ErrNetClosing},
31 {0, nil, &FD{ZeroReadIsEOF: false}, nil},
32 {0, io.EOF, &FD{ZeroReadIsEOF: false}, io.EOF},
33 {0, ErrNetClosing, &FD{ZeroReadIsEOF: false}, ErrNetClosing},
36 func TestEOFError(t *testing.T) {
37 for _, tt := range eofErrorTests {
38 actual := tt.fd.EOFError(tt.n, tt.err)
39 if actual != tt.expected {
40 t.Errorf("eofError(%v, %v, %v): expected %v, actual %v", tt.n, tt.err, tt.fd.ZeroReadIsEOF, tt.expected, actual)