diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-25 16:23:22 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-25 16:23:22 +0900 |
| commit | 2a348c7f912a17dbb0d29624cb3bef2add9d7492 (patch) | |
| tree | fd13835b3f70ccac14af4a6f47c1342d5ee0b6f7 /internal/system/acl_test.go | |
| parent | eb767e7642ccd581c9b29303f5e7e3b2adc87c09 (diff) | |
system: include more info in ACL Stringer
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/system/acl_test.go')
| -rw-r--r-- | internal/system/acl_test.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/internal/system/acl_test.go b/internal/system/acl_test.go index fe456c70..ed449ef3 100644 --- a/internal/system/acl_test.go +++ b/internal/system/acl_test.go @@ -49,21 +49,22 @@ func TestUpdatePermType(t *testing.T) { func TestACL_String(t *testing.T) { testCases := []struct { want string + et Enablement perms []acl.Perm }{ - {"---", []acl.Perm{}}, - {"r--", []acl.Perm{acl.Read}}, - {"-w-", []acl.Perm{acl.Write}}, - {"--x", []acl.Perm{acl.Execute}}, - {"rw-", []acl.Perm{acl.Read, acl.Write}}, - {"r-x", []acl.Perm{acl.Read, acl.Execute}}, - {"rwx", []acl.Perm{acl.Read, acl.Write, acl.Execute}}, - {"rwx", []acl.Perm{acl.Read, acl.Write, acl.Write, acl.Execute}}, + {`--- type: Process path: "/nonexistent"`, Process, []acl.Perm{}}, + {`r-- type: User path: "/nonexistent"`, User, []acl.Perm{acl.Read}}, + {`-w- type: Wayland path: "/nonexistent"`, EWayland, []acl.Perm{acl.Write}}, + {`--x type: X11 path: "/nonexistent"`, EX11, []acl.Perm{acl.Execute}}, + {`rw- type: D-Bus path: "/nonexistent"`, EDBus, []acl.Perm{acl.Read, acl.Write}}, + {`r-x type: PulseAudio path: "/nonexistent"`, EPulse, []acl.Perm{acl.Read, acl.Execute}}, + {`rwx type: User path: "/nonexistent"`, User, []acl.Perm{acl.Read, acl.Write, acl.Execute}}, + {`rwx type: Process path: "/nonexistent"`, Process, []acl.Perm{acl.Read, acl.Write, acl.Write, acl.Execute}}, } for _, tc := range testCases { t.Run(tc.want, func(t *testing.T) { - a := &ACL{perms: tc.perms} + a := &ACL{et: tc.et, perms: tc.perms, path: "/nonexistent"} if got := a.String(); got != tc.want { t.Errorf("String() = %v, want %v", got, tc.want) |
