summaryrefslogtreecommitdiff
path: root/src/pattern_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-08-20 03:33:55 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-08-20 12:29:11 +0900
commita2a4df088646a5f363f9321c52ef9ab9ba4706aa (patch)
treef4ff2f96b19be37582453bb1c28968c0b58d1549 /src/pattern_test.go
parent3399e39968473b1920db19ef1969b9df34bdd3c1 (diff)
downloadfzf-a2a4df088646a5f363f9321c52ef9ab9ba4706aa.tar.gz
Pass util.Chars by pointer
Diffstat (limited to 'src/pattern_test.go')
-rw-r--r--src/pattern_test.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pattern_test.go b/src/pattern_test.go
index 54d6f512..1930dddb 100644
--- a/src/pattern_test.go
+++ b/src/pattern_test.go
@@ -69,8 +69,9 @@ func TestExact(t *testing.T) {
clearPatternCache()
pattern := BuildPattern(true, algo.FuzzyMatchV2, true, CaseSmart, false, true, true,
[]Range{}, Delimiter{}, []rune("'abc"))
+ chars := util.ToChars([]byte("aabbcc abc"))
res, pos := algo.ExactMatchNaive(
- pattern.caseSensitive, pattern.normalize, pattern.forward, util.ToChars([]byte("aabbcc abc")), pattern.termSets[0][0].text, true, nil)
+ 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)
}
@@ -85,8 +86,9 @@ func TestEqual(t *testing.T) {
pattern := BuildPattern(true, algo.FuzzyMatchV2, true, CaseSmart, false, true, true, []Range{}, Delimiter{}, []rune("^AbC$"))
match := func(str string, sidxExpected int, eidxExpected int) {
+ chars := util.ToChars([]byte(str))
res, pos := algo.EqualMatch(
- pattern.caseSensitive, pattern.normalize, pattern.forward, util.ToChars([]byte(str)), pattern.termSets[0][0].text, true, nil)
+ 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)
}