summaryrefslogtreecommitdiffstats
path: root/src/pattern_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-03-01 12:36:02 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-03-01 12:36:02 +0900
commit4c9cab3f8ae7b55f7124d7c3cf7ac6b4cc3db210 (patch)
tree4c0e59346708bfd82a15743d13a56480d245d45e /src/pattern_test.go
parentb2c0413a98e210cedd34fbe0f6ba051906da398f (diff)
Fix prefix/suffix/equal matcher to trim whitespaces
- Prefix matcher will trim leading whitespaces only when the pattern doesn't start with a whitespace - Suffix matcher will trim trailing whitespaces only when the pattern doesn't end with a whitespace - Equal matcher will trim leading whitespaces only when the pattern doesn't start with a whitespace, and trim trailing whitespaces only when the pattern doesn't end with a whitespace Previously, only suffix matcher would trim whitespaces unconditionally. Fix #1894
Diffstat (limited to 'src/pattern_test.go')
-rw-r--r--src/pattern_test.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pattern_test.go b/src/pattern_test.go
index bfadf5d8..5a622952 100644
--- a/src/pattern_test.go
+++ b/src/pattern_test.go
@@ -98,6 +98,9 @@ func TestEqual(t *testing.T) {
}
match("ABC", -1, -1)
match("AbC", 0, 3)
+ match("AbC ", 0, 3)
+ match(" AbC ", 1, 4)
+ match(" AbC", 2, 5)
}
func TestCaseSensitivity(t *testing.T) {