aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-10-28 12:52:11 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2024-10-28 12:52:11 +0200
commit0e911d64e71a85d3958689debff0ccbee4c3891a (patch)
treec6883a7d44b48417956d98924f889a92daf29806 /tests
parentc10c90efd41294eca8dad0bd3a20abead33032c2 (diff)
Make .*search() functions not to match empty substrings in non empty strings
Diffstat (limited to 'tests')
-rw-r--r--tests/function/regex/testscript81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/function/regex/testscript b/tests/function/regex/testscript
index 538bdab..5564bbd 100644
--- a/tests/function/regex/testscript
+++ b/tests/function/regex/testscript
@@ -366,6 +366,33 @@
EOI
}
}
+
+ : empty-substring
+ :
+ : Note that the regex search-based replacement with the match_not_null flag
+ : is broken for older versions of libstdc++ and libc++.
+ :
+ if (($cxx.id != 'gcc' || $cxx.version.major >= 7) && \
+ ($cxx.id != 'clang' || $cxx.version.major >= 6))
+ {
+ : empty
+ :
+ $* <<EOI >'true'
+ print $regex.search('', '.*')
+ EOI
+
+ : match
+ :
+ $* <<EOI >'true'
+ print $regex.search('a', 'a*')
+ EOI
+
+ : no-match
+ :
+ $* <<EOI >'false'
+ print $regex.search('aa', 'b*')
+ EOI
+ }
}
: split
@@ -576,6 +603,33 @@
print $regex.find_search(Foo.cxx, 'f', icase)
EOI
}
+
+ : empty-substring
+ :
+ : Note that the regex search-based replacement with the match_not_null flag
+ : is broken for older versions of libstdc++ and libc++.
+ :
+ if (($cxx.id != 'gcc' || $cxx.version.major >= 7) && \
+ ($cxx.id != 'clang' || $cxx.version.major >= 6))
+ {
+ : empty
+ :
+ $* <<EOI >'true'
+ print $regex.find_search('', '.*')
+ EOI
+
+ : match
+ :
+ $* <<EOI >'true'
+ print $regex.find_search('a', 'a*')
+ EOI
+
+ : no-match
+ :
+ $* <<EOI >'false'
+ print $regex.find_search('aa', 'b*')
+ EOI
+ }
}
: filter-search
@@ -607,6 +661,33 @@
$* <<EOI >''
print $regex.filter_search(-g, '-O')
EOI
+
+ : empty-substring
+ :
+ : Note that the regex search-based replacement with the match_not_null flag
+ : is broken for older versions of libstdc++ and libc++.
+ :
+ if (($cxx.id != 'gcc' || $cxx.version.major >= 7) && \
+ ($cxx.id != 'clang' || $cxx.version.major >= 6))
+ {
+ : empty
+ :
+ $* <<EOI >'{}'
+ print $regex.filter_search('', '.*')
+ EOI
+
+ : match
+ :
+ $* <<EOI >'a'
+ print $regex.filter_search('a', 'a*')
+ EOI
+
+ : no-match
+ :
+ $* <<EOI >''
+ print $regex.filter_search('aa', 'b*')
+ EOI
+ }
}
: filter-out