1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/pkg/utils/match/name_test.go
Charles-Edouard Brétéché 2a22e8762a
refactor: match utils package (#5961)
* refactor: match utils package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-10 12:16:59 -08:00

55 lines
829 B
Go

package match
import "testing"
func TestCheckName(t *testing.T) {
type args struct {
expected string
actual string
}
tests := []struct {
name string
args args
want bool
}{{
args: args{},
want: true,
}, {
args: args{
expected: "",
actual: "foo",
},
want: false,
}, {
args: args{
expected: "*",
actual: "foo",
},
want: true,
}, {
args: args{
expected: "foo",
actual: "foo",
},
want: true,
}, {
args: args{
expected: "bar",
actual: "foo",
},
want: false,
}, {
args: args{
expected: "f?o",
actual: "foo",
},
want: true,
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := CheckName(tt.args.expected, tt.args.actual); got != tt.want {
t.Errorf("CheckName() = %v, want %v", got, tt.want)
}
})
}
}