package walk import ( "testing" "github.com/bmatcuk/doublestar/v4" ) func TestCheckPathMatchPattern(t *testing.T) { testCases := []struct { pattern string err error }{ {pattern: "*.pb.go", err: nil}, {pattern: "**/*.pb.go", err: nil}, {pattern: "**/*.pb.go", err: nil}, {pattern: "[]a]", err: doublestar.ErrBadPattern}, {pattern: "[c-", err: doublestar.ErrBadPattern}, } for _, testCase := range testCases { if want, got := testCase.err, checkPathMatchPattern(testCase.pattern); want != got { t.Errorf("checkPathMatchPattern %q: got %q want %q", testCase.pattern, got, want) } } }