summaryrefslogtreecommitdiff
path: root/match_test.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-07 19:53:55 +0300
committerEyal Posener <[email protected]>2017-05-07 19:57:41 +0300
commit6fb4875efa1f536813da29972a0c3250bde8b5eb (patch)
treec7ee97d75ed8d1d6c734256e3ff789402571bcca /match_test.go
parente8f6dfad584cb1e3082bc7ea82f8c0551dd944b3 (diff)
Move match to a separate package
Diffstat (limited to 'match_test.go')
-rw-r--r--match_test.go105
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)
- }
- })
- }
-}