diff options
| author | Eyal Posener <[email protected]> | 2017-05-08 06:33:45 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-05-08 06:33:45 +0300 |
| commit | 6dd6a04d241b1c267d686d5b4b112f8e8d3f7338 (patch) | |
| tree | 28d9df10ae15cb7736f6a57f904eaf95083097ee /match_test.go | |
| parent | e8f6dfad584cb1e3082bc7ea82f8c0551dd944b3 (diff) | |
| parent | 328144c31b5abd57be42f18ffb8a442c78619097 (diff) | |
Merge pull request #8 from posener/move-match
Move match
Diffstat (limited to 'match_test.go')
| -rw-r--r-- | match_test.go | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/match_test.go b/match_test.go deleted file mode 100644 index 8605194..0000000 --- a/match_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package complete - -import "testing" - -func TestMatch(t *testing.T) { - t.Parallel() - initTests() - - tests := []struct { - m Matcher - prefix string - want bool - }{ - { - m: MatchPrefix("abcd"), - prefix: "", - want: true, - }, - { - m: MatchPrefix("abcd"), - prefix: "ab", - want: true, - }, - { - m: MatchPrefix("abcd"), - prefix: "ac", - want: false, - }, - { - m: MatchPrefix(""), - prefix: "ac", - want: false, - }, - { - m: MatchPrefix(""), - prefix: "", - want: true, - }, - { - m: MatchFileName("file.txt"), - prefix: "", - want: true, - }, - { - m: MatchFileName("./file.txt"), - prefix: "", - want: true, - }, - { - m: MatchFileName("./file.txt"), - prefix: "f", - want: true, - }, - { - m: MatchFileName("./file.txt"), - prefix: "file.", - want: true, - }, - { - m: MatchFileName("./file.txt"), - prefix: "./f", - want: true, - }, - { - m: MatchFileName("./file.txt"), - prefix: "other.txt", - want: false, - }, - { - m: MatchFileName("./file.txt"), - prefix: "/file.txt", - want: false, - }, - { - m: MatchFileName("/file.txt"), - prefix: "file.txt", - want: false, - }, - { - m: MatchFileName("/file.txt"), - prefix: "./file.txt", - want: false, - }, - { - m: MatchFileName("/file.txt"), - prefix: "/file.txt", - want: true, - }, - { - m: MatchFileName("/file.txt"), - prefix: "/fil", - want: true, - }, - } - - for _, tt := range tests { - name := tt.m.String() + "/" + tt.prefix - t.Run(name, func(t *testing.T) { - got := tt.m.Match(tt.prefix) - if got != tt.want { - t.Errorf("Failed %s: got = %t, want: %t", name, got, tt.want) - } - }) - } -} |
