blob: fbe343a6b64332a9c4b33a96970bb230e2d194fd [file] [log] [blame] [edit]
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)
}
}
}