From e21dcb0eeab88397abc5ec2a07b7e19eba9d8a22 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 24 Oct 2020 18:26:30 +0200 Subject: [PATCH] dump: Additional ACL tests --- internal/dump/acl_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/dump/acl_test.go b/internal/dump/acl_test.go index fe930c986..bef11ad14 100644 --- a/internal/dump/acl_test.go +++ b/internal/dump/acl_test.go @@ -21,6 +21,13 @@ func Test_acl_decode(t *testing.T) { }, want: "user::rw-\nuser:0:rwx\nuser:65534:rwx\ngroup::rwx\nmask::rwx\nother::r--\n", }, + { + name: "decode group", + args: args{ + xattr: []byte{2, 0, 0, 0, 8, 0, 1, 0, 254, 255, 0, 0}, + }, + want: "group:65534:--x\n", + }, { name: "decode fail", args: args{ @@ -28,6 +35,13 @@ func Test_acl_decode(t *testing.T) { }, want: "", }, + { + name: "decode empty fail", + args: args{ + xattr: []byte(""), + }, + want: "", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -36,6 +50,10 @@ func Test_acl_decode(t *testing.T) { if tt.want != a.String() { t.Errorf("acl.decode() = %v, want: %v", a.String(), tt.want) } + a.decode(tt.args.xattr) + if tt.want != a.String() { + t.Errorf("second acl.decode() = %v, want: %v", a.String(), tt.want) + } }) } }