package glob import ( "reflect" "testing" ) func TestGlobFiles(t *testing.T) { tests := []struct { name string pattern string want []string wantErr bool }{ { name: "Test with valid pattern", pattern: "testfiles/**/*.{txt,md}", want: []string{ "testfiles/subdir1/test1.txt", "testfiles/subdir2/test2.md", }, wantErr: false, }, { name: "Test with partial pattern", pattern: "testfiles/**/test1.txt", want: []string{ "testfiles/subdir1/test1.txt", }, wantErr: false, }, { name: "Test with invalid pattern", pattern: "testfiles/**/test3.txt", want: nil, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GlobFiles(tt.pattern) if (err != nil) != tt.wantErr { t.Errorf("GlobFiles() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GlobFiles() got = %v, want %v", got, tt.want) } }) } }