From 2a348c7f912a17dbb0d29624cb3bef2add9d7492 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Fri, 25 Oct 2024 16:23:22 +0900 Subject: system: include more info in ACL Stringer Signed-off-by: Ophestra Umiker --- internal/system/acl_test.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'internal/system/acl_test.go') 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) -- cgit v1.3.1