util/test: export GetCases func #213
@ -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 {
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user