forked from tools/godep
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatch_test.go
More file actions
32 lines (30 loc) · 775 Bytes
/
match_test.go
File metadata and controls
32 lines (30 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import "testing"
func TestMatchPattern(t *testing.T) {
// Test cases from $GOROOT/src/cmd/go/match_test.go.
cases := []struct {
pat string
path string
want bool
}{
{"...", "foo", true},
{"net", "net", true},
{"net", "net/http", false},
{"net/http", "net", false},
{"net/http", "net/http", true},
{"net...", "netchan", true},
{"net...", "net", true},
{"net...", "net/http", true},
{"net...", "not/http", false},
{"net/...", "netchan", false},
{"net/...", "net", true},
{"net/...", "net/http", true},
{"net/...", "not/http", false},
}
for _, test := range cases {
ok := matchPattern(test.pat)(test.path)
if ok != test.want {
t.Errorf("matchPackages(%q)(%q) = %v want %v", test.pat, test.path, ok, test.want)
}
}
}