All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 1m46s
Test / Hakurei (push) Successful in 3m19s
Test / Hpkg (push) Successful in 3m45s
Test / Sandbox (race detector) (push) Successful in 5m5s
Test / Hakurei (race detector) (push) Successful in 3m8s
Test / Flake checks (push) Successful in 1m34s
Most of these were never updated after UpdatePerm was renamed to Update. Signed-off-by: Ophestra <cat@gensokyo.uk>
31 lines
709 B
Go
31 lines
709 B
Go
package acl_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"hakurei.app/system/acl"
|
|
)
|
|
|
|
func TestPerms(t *testing.T) {
|
|
testCases := []struct {
|
|
name string
|
|
perms acl.Perms
|
|
}{
|
|
{"---", acl.Perms{}},
|
|
{"r--", acl.Perms{acl.Read}},
|
|
{"-w-", acl.Perms{acl.Write}},
|
|
{"--x", acl.Perms{acl.Execute}},
|
|
{"rw-", acl.Perms{acl.Read, acl.Read, acl.Write}},
|
|
{"r-x", acl.Perms{acl.Read, acl.Execute, acl.Execute}},
|
|
{"-wx", acl.Perms{acl.Write, acl.Write, acl.Execute, acl.Execute}},
|
|
{"rwx", acl.Perms{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)
|
|
}
|
|
})
|
|
}
|
|
}
|