blob: 76fe015b221202daa295347072a1569ca2b05f81 [file] [log] [blame]
Brad Fitzpatrick7c15b2a2016-04-03 00:44:39 +00001// Copyright 2016 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.
4
5// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
6
7package os_test
8
9import (
10 "os"
11 "syscall"
12)
13
14func init() {
15 isExistTests = append(isExistTests,
16 isExistTest{err: &os.PathError{Err: syscall.EEXIST}, is: true, isnot: false},
17 isExistTest{err: &os.PathError{Err: syscall.ENOTEMPTY}, is: true, isnot: false},
18
19 isExistTest{err: &os.LinkError{Err: syscall.EEXIST}, is: true, isnot: false},
20 isExistTest{err: &os.LinkError{Err: syscall.ENOTEMPTY}, is: true, isnot: false},
21
22 isExistTest{err: &os.SyscallError{Err: syscall.EEXIST}, is: true, isnot: false},
23 isExistTest{err: &os.SyscallError{Err: syscall.ENOTEMPTY}, is: true, isnot: false},
24 )
25 isPermissionTests = append(isPermissionTests,
26 isPermissionTest{err: &os.PathError{Err: syscall.EACCES}, want: true},
27 isPermissionTest{err: &os.PathError{Err: syscall.EPERM}, want: true},
28 isPermissionTest{err: &os.PathError{Err: syscall.EEXIST}, want: false},
29
30 isPermissionTest{err: &os.LinkError{Err: syscall.EACCES}, want: true},
31 isPermissionTest{err: &os.LinkError{Err: syscall.EPERM}, want: true},
32 isPermissionTest{err: &os.LinkError{Err: syscall.EEXIST}, want: false},
33
34 isPermissionTest{err: &os.SyscallError{Err: syscall.EACCES}, want: true},
35 isPermissionTest{err: &os.SyscallError{Err: syscall.EPERM}, want: true},
36 isPermissionTest{err: &os.SyscallError{Err: syscall.EEXIST}, want: false},
37 )
38
39}