diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2022-07-21 21:21:06 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2022-07-21 21:21:06 +0900 |
commit | 0d06c28b1943e820440cff9182a0ae3bdd5e3c59 (patch) | |
tree | d261701bfd4af5a1d86f70676b14cbc45ea6c02d /src/options_test.go | |
parent | ccc46772525f8cbfbd3f1b836d43e07ec181c266 (diff) |
Fix delimiter regex to properly support caret (^)
Fix #2861
Diffstat (limited to 'src/options_test.go')
-rw-r--r-- | src/options_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/options_test.go b/src/options_test.go index bb946235..b411e58e 100644 --- a/src/options_test.go +++ b/src/options_test.go @@ -65,6 +65,19 @@ func TestDelimiterRegexRegex(t *testing.T) { } } +func TestDelimiterRegexRegexCaret(t *testing.T) { + delim := delimiterRegexp(`(^\s*|\s+)`) + tokens := Tokenize("foo bar baz", delim) + if delim.str != nil || + len(tokens) != 4 || + tokens[0].text.ToString() != "" || + tokens[1].text.ToString() != "foo " || + tokens[2].text.ToString() != "bar " || + tokens[3].text.ToString() != "baz" { + t.Errorf("%s %d", tokens, len(tokens)) + } +} + func TestSplitNth(t *testing.T) { { ranges := splitNth("..") |