From 5460517bd2ecf5c3437cfe77821b3cf524bc69d5 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 12 Jan 2025 10:23:43 +0900 Subject: Treat a single-character delimiter as a plain string delimiter even if it's a regular expression meta-character Close #4170 --- src/options_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/options_test.go') diff --git a/src/options_test.go b/src/options_test.go index 5def73dc..40d2920b 100644 --- a/src/options_test.go +++ b/src/options_test.go @@ -9,9 +9,13 @@ import ( ) func TestDelimiterRegex(t *testing.T) { - // Valid regex + // Valid regex, but a single character -> string delim := delimiterRegexp(".") - if delim.regex == nil || delim.str != nil { + if delim.regex != nil || *delim.str != "." { + t.Error(delim) + } + delim = delimiterRegexp("|") + if delim.regex != nil || *delim.str != "|" { t.Error(delim) } // Broken regex -> string -- cgit v1.2.3