...
Source file
src/os/error_unix_test.go
Documentation: os
1
2
3
4
5
6
7
8 package os_test
9
10 import (
11 "io/fs"
12 "os"
13 "syscall"
14 )
15
16 func init() {
17 isExistTests = append(isExistTests,
18 isExistTest{err: &fs.PathError{Err: syscall.EEXIST}, is: true, isnot: false},
19 isExistTest{err: &fs.PathError{Err: syscall.ENOTEMPTY}, is: true, isnot: false},
20
21 isExistTest{err: &os.LinkError{Err: syscall.EEXIST}, is: true, isnot: false},
22 isExistTest{err: &os.LinkError{Err: syscall.ENOTEMPTY}, is: true, isnot: false},
23
24 isExistTest{err: &os.SyscallError{Err: syscall.EEXIST}, is: true, isnot: false},
25 isExistTest{err: &os.SyscallError{Err: syscall.ENOTEMPTY}, is: true, isnot: false},
26 )
27 isPermissionTests = append(isPermissionTests,
28 isPermissionTest{err: &fs.PathError{Err: syscall.EACCES}, want: true},
29 isPermissionTest{err: &fs.PathError{Err: syscall.EPERM}, want: true},
30 isPermissionTest{err: &fs.PathError{Err: syscall.EEXIST}, want: false},
31
32 isPermissionTest{err: &os.LinkError{Err: syscall.EACCES}, want: true},
33 isPermissionTest{err: &os.LinkError{Err: syscall.EPERM}, want: true},
34 isPermissionTest{err: &os.LinkError{Err: syscall.EEXIST}, want: false},
35
36 isPermissionTest{err: &os.SyscallError{Err: syscall.EACCES}, want: true},
37 isPermissionTest{err: &os.SyscallError{Err: syscall.EPERM}, want: true},
38 isPermissionTest{err: &os.SyscallError{Err: syscall.EEXIST}, want: false},
39 )
40
41 }
42
View as plain text