diff --git a/pkg/aa/profile_test.go b/pkg/aa/profile_test.go new file mode 100644 index 00000000..db3ec359 --- /dev/null +++ b/pkg/aa/profile_test.go @@ -0,0 +1,32 @@ +// apparmor.d - Full set of apparmor profiles +// Copyright (C) 2023 Alexandre Pujol +// SPDX-License-Identifier: GPL-2.0-only + +package aa + +import ( + "testing" +) + +func TestAppArmorProfile_String(t *testing.T) { + tests := []struct { + name string + p AppArmorProfile + want string + }{ + { + name: "empty", + p: AppArmorProfile{}, + want: `profile { +} +`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := tt.p.String(); got != tt.want { + t.Errorf("AppArmorProfile.String() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/pkg/aa/rules.go b/pkg/aa/rules.go index 3244247d..997bbd1f 100644 --- a/pkg/aa/rules.go +++ b/pkg/aa/rules.go @@ -4,10 +4,6 @@ package aa -import ( - "golang.org/x/exp/slices" -) - // Preamble section of a profile type Preamble struct { Abi []Abi diff --git a/pkg/aa/template.go b/pkg/aa/template.go index a577af54..2484c704 100644 --- a/pkg/aa/template.go +++ b/pkg/aa/template.go @@ -6,7 +6,6 @@ package aa import ( _ "embed" - "strings" "text/template" )