summaryrefslogtreecommitdiff
path: root/src/pattern_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-08-09 23:25:32 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-08-09 23:28:47 +0900
commite85a8a68d0248a6edfb6ef63c5edb4bcbe18f954 (patch)
tree0831c315a1022f08eaa2331f58015fb5c61007c5 /src/pattern_test.go
parentdc55e68524a84544417c1ce290df447c4f0b1d60 (diff)
downloadfzf-e85a8a68d0248a6edfb6ef63c5edb4bcbe18f954.tar.gz
Allow escaping meta characters with backslashes
One can escape meta characters in extended-search mode with backslashes. Prefixes: \' \! \^ Suffix: \$ Term separator: \<SPACE> To keep things simple, we are not going to support escaping of escaped sequences (e.g. \\') for matching them literally. Since this is a breaking change, we will bump the minor version. Close #444
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 9d56ff9f..efb1ef2d 100644
--- a/src/pattern_test.go
+++ b/src/pattern_test.go
@@ -165,15 +165,15 @@ func TestCacheKey(t *testing.T) {
t.Errorf("Expected: %s, actual: %s", expected, pat.CacheKey())
}
if pat.cacheable != cacheable {
- t.Errorf("Expected: %s, actual: %s (%s)", cacheable, pat.cacheable, patStr)
+ t.Errorf("Expected: %t, actual: %t (%s)", cacheable, pat.cacheable, patStr)
}
clearPatternCache()
}
test(false, "foo !bar", "foo !bar", true)
test(false, "foo | bar !baz", "foo | bar !baz", true)
- test(true, "foo bar baz", "foo bar baz", true)
+ test(true, "foo bar baz", "foo\tbar\tbaz", true)
test(true, "foo !bar", "foo", false)
- test(true, "foo !bar baz", "foo baz", false)
+ test(true, "foo !bar baz", "foo\tbaz", false)
test(true, "foo | bar baz", "baz", false)
test(true, "foo | bar | baz", "", false)
test(true, "foo | bar !baz", "", false)
@@ -192,11 +192,11 @@ func TestCacheable(t *testing.T) {
}
clearPatternCache()
}
- test(true, "foo bar", "foo bar", true)
- test(true, "foo 'bar", "foo bar", false)
+ test(true, "foo bar", "foo\tbar", true)
+ test(true, "foo 'bar", "foo\tbar", false)
test(true, "foo !bar", "foo", false)
- test(false, "foo bar", "foo bar", true)
+ test(false, "foo bar", "foo\tbar", true)
test(false, "foo 'bar", "foo", false)
test(false, "foo '", "foo", true)
test(false, "foo 'bar", "foo", false)