@@ -28,14 +28,15 @@ func TestParseGlobExpressionVsDoublestar(t *testing.T) {
2828 "src/foo/**/*.go" : {"src/main.go" , "src/foo/main.go" , "src/foo/bar/main.go" , "foo/src/main.go" , "main.go" , "src/foo/src/main.go" },
2929
3030 // With prefix and suffix that are equal
31- "foo/**/foo" : {"foo" , "foo/foo" , "foo/bar/foo" , "foo/foo/foo" },
31+ "foo/**/foo" : {"foo" , "foo/foo" , "foo/bar/foo" , "foo/bar/NOTfoo" , "foo/foo/foo" },
32+ "src/**/important.ts" : {"important.ts" , "NOTimportant.ts" , "NOT.important.ts" , "important.NOT.ts" , "src/important.ts" , "src/NOTimportant.ts" , "src/NOT.important.ts" , "src/important.NOT.ts" },
3233
3334 // Body with doublestars
3435 "**/foo/**" : {"foo/bar" , "a/foo/baz" , "a/b/c/foo/d/e" , "foo" , "a/b/c/foo" , "foo/a/b/c" },
3536
3637 // Starting doublestars
37- "**/WORKSPACE" : {"WORKSPACE" , "WORKSPACE.bazel" , "a/WORKSPACE" , "WORKSPACE.txt" , "a/WORKSPACE.bazel" },
38- "**/WORKSPACE.bazel" : {"WORKSPACE" , "WORKSPACE.bazel" , "a/WORKSPACE" , "WORKSPACE.txt" , "a/WORKSPACE.bazel" },
38+ "**/WORKSPACE" : {"WORKSPACE" , "notWORKSPACE" , "notWORKSPACE.bazel" , " WORKSPACE.bazel" , "a/WORKSPACE" , "a/notWORKSPACE" , " WORKSPACE.txt" , "a/WORKSPACE.bazel" , "a/notWORKSPACE .bazel" },
39+ "**/WORKSPACE.bazel" : {"WORKSPACE" , "notWORKSPACE" , "notWORKSPACE.bazel" , " WORKSPACE.bazel" , "a/WORKSPACE" , "a/notWORKSPACE" , " WORKSPACE.txt" , "a/WORKSPACE.bazel" , "a/notWORKSPACE .bazel" },
3940 "**/@foo/bar" : {"@foo/bar/baz" , "@foo/bar" , "foo/bar" , "a/@foo/bar" },
4041 "**/*.go" : {"main.go" , "src/main.go" , "src/deep/nested/file.go" },
4142 "**/*_test.go" : {"src/test_file.go" , "src/path/test_file.go" , "deep/nested/test_file.go" },
@@ -57,7 +58,8 @@ func TestParseGlobExpressionVsDoublestar(t *testing.T) {
5758 }
5859
5960 for testPattern , testCases := range tests {
60- expr , err := ParseGlobExpression (testPattern )
61+ expr := parseGlobExpression (testPattern )
62+ expr2 , err := parseGlobExpressions ([]string {testPattern })
6163
6264 // Verify doublestar agrees on validity
6365 if (err == nil ) != doublestar .ValidatePattern (testPattern ) {
@@ -69,6 +71,10 @@ func TestParseGlobExpressionVsDoublestar(t *testing.T) {
6971 if expr (c ) != doublestar .MatchUnvalidated (testPattern , c ) {
7072 t .Errorf ("pattern %q did not align with doublestar with case %q" , testPattern , c )
7173 }
74+
75+ if expr (c ) != expr2 (c ) {
76+ t .Errorf ("pattern %q did not align between ParseGlobExpression(s) with case %q" , testPattern , c )
77+ }
7278 }
7379 }
7480}
0 commit comments