From 6fb4875efa1f536813da29972a0c3250bde8b5eb Mon Sep 17 00:00:00 2001 From: Eyal Posener Date: Sun, 7 May 2017 19:53:55 +0300 Subject: Move match to a separate package --- match_test.go | 105 ---------------------------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 match_test.go (limited to 'match_test.go') 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) - } - }) - } -} -- cgit v1.2.3