fix test case handling and update a function comment

This commit is contained in:
koba1t
2023-05-25 04:25:10 +09:00
parent 694b3c9318
commit 8383b28322
2 changed files with 5 additions and 3 deletions

View File

@@ -30,8 +30,8 @@ func GlobPatterns(fSys filesys.FileSystem, patterns []string) ([]string, error)
return result, nil
}
// GlobPatterns accepts a slice of glob strings and returns the set of
// matching file paths. If files are not found, will try load from remote.
// GlobPatterns accepts a slice of glob strings and returns the set of matching file paths. If files are not found, will try load from remote.
// It returns an error if there are no matching files or it can't load from remote.
func GlobPatternsWithLoader(fSys filesys.FileSystem, ldr ifc.Loader, patterns []string) ([]string, error) {
var result []string
for _, pattern := range patterns {

View File

@@ -91,7 +91,9 @@ func TestGlobPatternsWithLoaderRemoteFile(t *testing.T) {
// test load invalid file
invalidURL := "http://invalid"
resources, err = GlobPatternsWithLoader(fSys, ldr, []string{invalidURL})
if err != nil && err.Error() != invalidURL+" has no match: "+invalidURL+" not exist" {
if err == nil {
t.Fatalf("expected error but did not receive one")
} else if err.Error() != invalidURL+" has no match: "+invalidURL+" not exist" {
t.Fatalf("unexpected load error: %v", err)
}
if len(resources) > 0 {