diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-06-28 13:44:41 +0200 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-06-28 13:44:41 +0200 |
| commit | 7bd7bdad687e5f790afda6f0f22444f3a169a6b1 (patch) | |
| tree | 4cafda53c6a7aec2cd49b6b7dd3b2d488e462b0e /tests | |
| parent | 0dfb113b47d958093e6ae086c9695e5be83b24b8 (diff) | |
This was using g_regex_escape_string() which always translates a null byte
to `\0`, which is ambiguous if followed by other digits, so a null byte followed
by a digit would result in a wrong regular expression.
Actually the same could happen outside of character classes, ie. `@S/^@1/` was also broken.
Also it does not escape `-`, so the result cannot be used in character classes.
This is fixed now in a new custom implementation teco_regex_escape().
Once moving to a custom terex lexer, we won't need any of this of course
unless we want to provide a regex escaping string building construct.
We are now completely free of GRegex.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/testsuite.at | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/testsuite.at b/tests/testsuite.at index a97e0f8..98425d1 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -515,6 +515,11 @@ AT_SETUP([Search for one of characters in uninitialized Q-Register]) TE_CHECK([[:@S/^EGa/"S(0/0)']], 0, ignore, ignore) AT_CLEANUP +AT_SETUP([Search for class with special characters]) +# Relevant when patterns are internally converted to regular expressions. +TE_CHECK([[![! @I/^@-]B/J ![! @EUc/^@1]A-C/ ::@S/^EM^EGc/"F(0/0)' ^S+3"N(0/0)']], 0, ignore, ignore) +AT_CLEANUP + AT_SETUP([Search accesses wrong Q-Register table]) TE_CHECK([[@^U.#xx/123/ @^Um{:@S/^EG.#xx/$} :Mm Mm]], 1, ignore, ignore) AT_CLEANUP |
