1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 07:57:07 +00:00
kyverno/cmd/cli/kubectl-kyverno/test/test_case_test.go

46 lines
788 B
Go
Raw Normal View History

package test
import (
"testing"
"github.com/go-git/go-billy/v5"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/apis/v1alpha1"
)
func TestTestCase_Dir(t *testing.T) {
type fields struct {
}
tests := []struct {
name string
Path string
Fs billy.Filesystem
Test *v1alpha1.Test
Err error
want string
}{{
name: "empty",
want: ".",
}, {
name: "relative",
Path: "foo/bar/baz.yaml",
want: "foo/bar",
}, {
name: "absolute",
Path: "/foo/bar/baz.yaml",
want: "/foo/bar",
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tc := TestCase{
Path: tt.Path,
Fs: tt.Fs,
Test: tt.Test,
Err: tt.Err,
}
if got := tc.Dir(); got != tt.want {
t.Errorf("TestCase.Dir() = %v, want %v", got, tt.want)
}
})
}
}