Source file
src/syscall/syscall_plan9_test.go
1
2
3
4
5 package syscall_test
6
7 import (
8 "syscall"
9 "testing"
10 )
11
12
13
14 func testalias(t *testing.T, fn string, sys1, sys2 func() error) {
15 err := sys1().Error()
16 errcopy := string([]byte(err))
17 sys2()
18 if err != errcopy {
19 t.Errorf("syscall.%s error string changed from %q to %q\n", fn, errcopy, err)
20 }
21 }
22
23
24
25 func TestPlan9Syserr(t *testing.T) {
26 testalias(t,
27 "Syscall",
28 func() error {
29 return syscall.Mkdir("/", 0)
30 },
31 func() error {
32 return syscall.Mkdir("#", 0)
33 })
34 testalias(t,
35 "Syscall6",
36 func() error {
37 return syscall.Mount(0, 0, "", 0, "")
38 },
39 func() error {
40 return syscall.Mount(-1, 0, "", 0, "")
41 })
42
43 testalias(t,
44 "seek",
45 func() error {
46 _, err := syscall.Seek(0, 0, -1)
47 return err
48 },
49 func() error {
50 _, err := syscall.Seek(-1, 0, 0)
51 return err
52 })
53 }
54
View as plain text