mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
56 lines
829 B
Go
56 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)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|