1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package acl_test
import (
"testing"
"hakurei.app/internal/acl"
)
func TestPerms(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
perms acl.Perm
}{
{"---", 0},
{"r--", acl.Read},
{"-w-", acl.Write},
{"--x", acl.Execute},
{"rw-", acl.Read | acl.Write},
{"r-x", acl.Read | acl.Execute},
{"-wx", acl.Write | acl.Execute},
{"rwx", acl.Read | acl.Write | acl.Execute},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
if got := tc.perms.String(); got != tc.name {
t.Errorf("String: %q, want %q", got, tc.name)
}
})
}
}
|