util/test: export GetCases func #213

Merged
vtolstov merged 1 commits from GetCases into master 2023-04-19 01:23:54 +03:00
2 changed files with 5 additions and 5 deletions
Showing only changes of commit e403ae3d8e - Show all commits

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 { 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 { if err != nil {
return err return err
} }
@ -218,7 +218,7 @@ type Case struct {
rspfiles []string rspfiles []string
} }
func getFiles(dir string, exts []string) ([]Case, error) { func GetCases(dir string, exts []string) ([]Case, error) {
var tcases []Case var tcases []Case
entries, err := os.ReadDir(dir) entries, err := os.ReadDir(dir)
if len(entries) == 0 && err != nil { if len(entries) == 0 && err != nil {
@ -263,7 +263,7 @@ func getFiles(dir string, exts []string) ([]Case, error) {
} }
for _, dir = range dirs { for _, dir = range dirs {
ntcases, err := getFiles(dir, exts) ntcases, err := GetCases(dir, exts)
if len(ntcases) == 0 && err != nil { if len(ntcases) == 0 && err != nil {
return tcases, err return tcases, err
} else if len(ntcases) == 0 { } else if len(ntcases) == 0 {

View File

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