C++: Add NUL-escape tests (pre-fix)

This commit is contained in:
copilot-swe-agent[bot]
2026-07-23 10:18:01 +00:00
committed by GitHub
parent 31ae5fe021
commit c49213f66c
3 changed files with 21 additions and 0 deletions

View File

@@ -26,6 +26,12 @@
#-----| [RegExpConstant, RegExpNormalChar] b
#-----| [RegExpConstant, RegExpNormalChar] \
#-----| [RegExpConstant, RegExpNormalChar] 0
#-----| [RegExpConstant, RegExpNormalChar] \0
#-----| [RegExpConstant, RegExpEscape] \cZ
#-----| [RegExpConstant, RegExpEscape] \cA
@@ -283,6 +289,10 @@
#-----| 0 -> [RegExpConstant, RegExpNormalChar] 0
#-----| 1 -> [RegExpConstant, RegExpNormalChar] 9
#-----| [RegExpCharacterClass] [\0]
#-----| 0 -> [RegExpConstant, RegExpNormalChar] \
#-----| 1 -> [RegExpConstant, RegExpNormalChar] 0
#-----| [RegExpCharacterClass] [\cZ]
#-----| 0 -> [RegExpConstant, RegExpEscape] \cZ

View File

@@ -80,6 +80,10 @@ std::regex r_uni("\\u{9879}");
std::regex r_ctrl1("\\cA");
std::regex r_ctrl2("[\\cZ]");
// NUL escape
std::regex r_nul1("\\0");
std::regex r_nul2("[\\0]");
// String literal spellings for location tests
std::regex r_loc_plain("a\\nb");
std::basic_regex<wchar_t> r_loc_L(L"abc");

View File

@@ -6,6 +6,7 @@ groupNumber
| file://:0:0:0:0 | (o\|b) | 1 |
term
| file://:0:0:0:0 | 0 | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | 0 | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | 0-9 | RegExpCharacterRange |
| file://:0:0:0:0 | 1 | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | 2 | RegExpConstant,RegExpNormalChar |
@@ -48,6 +49,7 @@ term
| file://:0:0:0:0 | [[:digit:]] | RegExpCharacterClass |
| file://:0:0:0:0 | [[a-f] | RegExpCharacterClass |
| file://:0:0:0:0 | [[a-f]A-F] | RegExpSequence |
| file://:0:0:0:0 | [\\0] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\cZ] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\w] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\w]+ | RegExpPlus |
@@ -58,6 +60,8 @@ term
| file://:0:0:0:0 | [^]] | RegExpCharacterClass |
| file://:0:0:0:0 | [a-fA-F0-9_] | RegExpCharacterClass |
| file://:0:0:0:0 | [abc] | RegExpCharacterClass |
| file://:0:0:0:0 | \\ | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | \\0 | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | \\1 | RegExpBackRef |
| file://:0:0:0:0 | \\B | RegExpNonWordBoundary |
| file://:0:0:0:0 | \\D | RegExpCharacterClassEscape |
@@ -154,6 +158,7 @@ term
| file://:0:0:0:0 | o\|b | RegExpAlt |
regExpNormalCharValue
| file://:0:0:0:0 | 0 | 0 |
| file://:0:0:0:0 | 0 | 0 |
| file://:0:0:0:0 | 1 | 1 |
| file://:0:0:0:0 | 2 | 2 |
| file://:0:0:0:0 | 3 | 3 |
@@ -169,6 +174,8 @@ regExpNormalCharValue
| file://:0:0:0:0 | F | F |
| file://:0:0:0:0 | Z | Z |
| file://:0:0:0:0 | [ | [ |
| file://:0:0:0:0 | \\ | \\ |
| file://:0:0:0:0 | \\0 | \\0 |
| file://:0:0:0:0 | \\D | D |
| file://:0:0:0:0 | \\S | S |
| file://:0:0:0:0 | \\W | W |