summaryrefslogtreecommitdiffstats
path: root/src/pattern_test.go
diff options
context:
space:
mode:
authorRyan Boehning <ryanboehning@gmail.com>2018-02-17 14:01:06 -0800
committerJunegunn Choi <junegunn.c@gmail.com>2018-03-13 14:56:55 +0900
commit21b94d2de5bdf2d8c4e8107e4c197a2abc1e7275 (patch)
treed7255fcd66e512a40016ac220d84574f22c0d551 /src/pattern_test.go
parent24236860c89242ac0a341ff911c93f25032dc051 (diff)
Make fzf pass go vet
Add String() methods to types, so they can be printed with %s. Change some %s format specifiers to %v, when the default string representation is good enough. In Go 1.10, `go test` triggers a parallel `go vet`. So this also makes fzf pass `go test`. Close #1236 Close #1219
Diffstat (limited to 'src/pattern_test.go')
-rw-r--r--src/pattern_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pattern_test.go b/src/pattern_test.go
index 1930dddb..bfadf5d8 100644
--- a/src/pattern_test.go
+++ b/src/pattern_test.go
@@ -31,12 +31,12 @@ func TestParseTermsExtended(t *testing.T) {
terms[8][1].typ != termExact || terms[8][1].inv ||
terms[8][2].typ != termSuffix || terms[8][2].inv ||
terms[8][3].typ != termExact || !terms[8][3].inv {
- t.Errorf("%s", terms)
+ t.Errorf("%v", terms)
}
for _, termSet := range terms[:8] {
term := termSet[0]
if len(term.text) != 3 {
- t.Errorf("%s", term)
+ t.Errorf("%v", term)
}
}
}
@@ -53,14 +53,14 @@ func TestParseTermsExtendedExact(t *testing.T) {
terms[5][0].typ != termFuzzy || !terms[5][0].inv || len(terms[5][0].text) != 3 ||
terms[6][0].typ != termPrefix || !terms[6][0].inv || len(terms[6][0].text) != 3 ||
terms[7][0].typ != termSuffix || !terms[7][0].inv || len(terms[7][0].text) != 3 {
- t.Errorf("%s", terms)
+ t.Errorf("%v", terms)
}
}
func TestParseTermsEmpty(t *testing.T) {
terms := parseTerms(true, CaseSmart, false, "' ^ !' !^")
if len(terms) != 0 {
- t.Errorf("%s", terms)
+ t.Errorf("%v", terms)
}
}
@@ -73,7 +73,7 @@ func TestExact(t *testing.T) {
res, pos := algo.ExactMatchNaive(
pattern.caseSensitive, pattern.normalize, pattern.forward, &chars, pattern.termSets[0][0].text, true, nil)
if res.Start != 7 || res.End != 10 {
- t.Errorf("%s / %d / %d", pattern.termSets, res.Start, res.End)
+ t.Errorf("%v / %d / %d", pattern.termSets, res.Start, res.End)
}
if pos != nil {
t.Errorf("pos is expected to be nil")
@@ -90,7 +90,7 @@ func TestEqual(t *testing.T) {
res, pos := algo.EqualMatch(
pattern.caseSensitive, pattern.normalize, pattern.forward, &chars, pattern.termSets[0][0].text, true, nil)
if res.Start != sidxExpected || res.End != eidxExpected {
- t.Errorf("%s / %d / %d", pattern.termSets, res.Start, res.End)
+ t.Errorf("%v / %d / %d", pattern.termSets, res.Start, res.End)
}
if pos != nil {
t.Errorf("pos is expected to be nil")