From 4c9cab3f8ae7b55f7124d7c3cf7ac6b4cc3db210 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 1 Mar 2020 12:36:02 +0900 Subject: 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 --- src/pattern_test.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/pattern_test.go') 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) { -- cgit v1.2.3