Merge pull request 'util/test: export GetCases func' (#213) from GetCases into master

Reviewed-on: #213
This commit is contained in:
Василий Толстов 2023-04-19 01:23:53 +03:00
commit 814b90efe5
2 changed files with 5 additions and 5 deletions

View File

@ -157,7 +157,7 @@ func SQLFromReader(m sqlmock.Sqlmock, r io.Reader) error {
}
func RunWithClientExpectResults(ctx context.Context, c client.Client, m sqlmock.Sqlmock, dir string, exts []string) error {
tcases, err := getFiles(dir, exts)
tcases, err := GetCases(dir, exts)
if err != nil {
return err
}
@ -218,7 +218,7 @@ type Case struct {
rspfiles []string
}
func getFiles(dir string, exts []string) ([]Case, error) {
func GetCases(dir string, exts []string) ([]Case, error) {
var tcases []Case
entries, err := os.ReadDir(dir)
if len(entries) == 0 && err != nil {
@ -263,7 +263,7 @@ func getFiles(dir string, exts []string) ([]Case, error) {
}
for _, dir = range dirs {
ntcases, err := getFiles(dir, exts)
ntcases, err := GetCases(dir, exts)
if len(ntcases) == 0 && err != nil {
return tcases, err
} else if len(ntcases) == 0 {

View File

@ -56,8 +56,8 @@ func Test_SQLFromFile(t *testing.T) {
}
}
func Test_getFiles(t *testing.T) {
files, err := getFiles("testdata/", nil)
func Test_GetCases(t *testing.T) {
files, err := GetCases("testdata/", nil)
if err != nil {
t.Fatal(err)
}