@@ -206,3 +206,48 @@ func TestFollowSymlinks(t *testing.T) {
206
206
t .Errorf ("Expected no error, but got %v" , err )
207
207
}
208
208
}
209
+
210
+ func TestGlobPattern (t * testing.T ) {
211
+ // Arrange
212
+ tests := []struct {
213
+ pattern string
214
+ expected []string
215
+ }{
216
+ {
217
+ pattern : "testdata/glob/*/queries" ,
218
+ expected : []string {
219
+ "testdata/glob/sub1/queries/file1.sql" ,
220
+ "testdata/glob/sub2/queries/file2.sql" ,
221
+ "testdata/glob/sub3/queries/file3.sql" ,
222
+ "testdata/glob/sub3/queries/file4.sql" ,
223
+ },
224
+ },
225
+ {
226
+ pattern : "testdata/glob/sub3/queries/file?.sql" ,
227
+ expected : []string {
228
+ "testdata/glob/sub3/queries/file3.sql" ,
229
+ "testdata/glob/sub3/queries/file4.sql" ,
230
+ },
231
+ },
232
+ {
233
+ pattern : "testdata/glob/sub3/queries/file[1-5].sql" ,
234
+ expected : []string {
235
+ "testdata/glob/sub3/queries/file3.sql" ,
236
+ "testdata/glob/sub3/queries/file4.sql" ,
237
+ },
238
+ },
239
+ }
240
+
241
+ for _ , test := range tests {
242
+ // Act
243
+ result , err := Glob ([]string {test .pattern })
244
+
245
+ // Assert
246
+ if ! cmp .Equal (result , test .expected ) {
247
+ t .Errorf ("Pattern %v: Expected %v, but got %v" , test .pattern , test .expected , result )
248
+ }
249
+ if err != nil {
250
+ t .Errorf ("Pattern %v: Expected no error, but got %v" , test .pattern , err )
251
+ }
252
+ }
253
+ }
0 commit comments