1package glob
2
3import "testing"
4
5func TestMatch(t *testing.T) {
6 tests := []struct {
7 pattern string
8 name string
9 want bool
10 }{
11 {"internal/domain/**", "internal/domain/user.go", true},
12 {"internal/domain/**", "internal/domain/entity/user.go", true},
13 {"cmd/**", "cmd/hexcheck/main.go", true},
14 {"cmd/**", "internal/cmd/main.go", false},
15 {"internal/*/port/**", "internal/application/port/user.go", true},
16 {"internal/*/port/**", "internal/application/usecase/user.go", false},
17 {"internal/foo_test.go", "internal/foo_test.go", true},
18 }
19 for _, tt := range tests {
20 if got := Match(tt.pattern, tt.name); got != tt.want {
21 t.Fatalf("Match(%q, %q) = %v, want %v", tt.pattern, tt.name, got, tt.want)
22 }
23 }
24}