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

This commit is contained in:
copilot-swe-agent[bot]
2026-07-23 10:16:18 +00:00
committed by GitHub
parent 8e6b168730
commit cc45b0794b
3 changed files with 30 additions and 0 deletions

View File

@@ -26,6 +26,14 @@
#-----| [RegExpConstant, RegExpNormalChar] b
#-----| [RegExpConstant, RegExpEscape] \c
#-----| [RegExpConstant, RegExpNormalChar] Z
#-----| [RegExpConstant, RegExpEscape] \c
#-----| [RegExpConstant, RegExpNormalChar] A
#-----| [RegExpConstant, RegExpEscape] \u{987
#-----| [RegExpConstant, RegExpNormalChar] A
@@ -163,6 +171,10 @@
#-----| 1 -> [RegExpConstant, RegExpEscape] \n
#-----| 2 -> [RegExpConstant, RegExpNormalChar] b
#-----| [RegExpSequence] \cA
#-----| 0 -> [RegExpConstant, RegExpEscape] \c
#-----| 1 -> [RegExpConstant, RegExpNormalChar] A
#-----| [RegExpSequence] [[:alpha:]][[:digit:]]
#-----| 0 -> [RegExpCharacterClass] [[:alpha:]]
#-----| 1 -> [RegExpCharacterClass] [[:digit:]]
@@ -279,6 +291,10 @@
#-----| 0 -> [RegExpConstant, RegExpNormalChar] 0
#-----| 1 -> [RegExpConstant, RegExpNormalChar] 9
#-----| [RegExpCharacterClass] [\cZ]
#-----| 0 -> [RegExpConstant, RegExpEscape] \c
#-----| 1 -> [RegExpConstant, RegExpNormalChar] Z
#-----| [RegExpCharacterClass] [A-F[:digit:]a-f]
#-----| 0 -> [RegExpCharacterRange] A-F

View File

@@ -76,6 +76,10 @@ std::regex r_posix4("[:digit:]");
// unicode
std::regex r_uni("\\u{9879}");
// control escapes
std::regex r_ctrl1("\\cA");
std::regex r_ctrl2("[\\cZ]");
// 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

@@ -32,6 +32,7 @@ term
| file://:0:0:0:0 | A | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | A | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | A | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | A | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | A-F | RegExpCharacterRange |
| file://:0:0:0:0 | A-F | RegExpCharacterRange |
| file://:0:0:0:0 | A-F] | RegExpConstant,RegExpNormalChar |
@@ -39,6 +40,7 @@ term
| file://:0:0:0:0 | F | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | F | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | Z | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | Z | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | [ | RegExpConstant,RegExpNormalChar |
| file://:0:0:0:0 | [123] | RegExpCharacterClass |
| file://:0:0:0:0 | [A-F[:digit:]a-f] | RegExpCharacterClass |
@@ -48,6 +50,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 | [\\cZ] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\w] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\w]+ | RegExpPlus |
| file://:0:0:0:0 | [\|] | RegExpCharacterClass |
@@ -67,6 +70,9 @@ term
| file://:0:0:0:0 | \\] | RegExpConstant,RegExpEscape |
| file://:0:0:0:0 | \\b | RegExpSpecialChar |
| file://:0:0:0:0 | \\b!a\\B | RegExpSequence |
| file://:0:0:0:0 | \\c | RegExpConstant,RegExpEscape |
| file://:0:0:0:0 | \\c | RegExpConstant,RegExpEscape |
| file://:0:0:0:0 | \\cA | RegExpSequence |
| file://:0:0:0:0 | \\d | RegExpCharacterClassEscape |
| file://:0:0:0:0 | \\d\\D | RegExpSequence |
| file://:0:0:0:0 | \\n | RegExpConstant,RegExpEscape |
@@ -161,16 +167,20 @@ regExpNormalCharValue
| file://:0:0:0:0 | A | A |
| file://:0:0:0:0 | A | A |
| file://:0:0:0:0 | A | A |
| file://:0:0:0:0 | A | A |
| file://:0:0:0:0 | A-F] | A-F] |
| file://:0:0:0:0 | F | F |
| file://:0:0:0:0 | F | F |
| file://:0:0:0:0 | Z | Z |
| file://:0:0:0:0 | Z | Z |
| file://: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 |
| file://:0:0:0:0 | \\[ | [ |
| file://:0:0:0:0 | \\] | ] |
| file://:0:0:0:0 | \\c | c |
| file://:0:0:0:0 | \\c | c |
| file://:0:0:0:0 | \\d | d |
| file://:0:0:0:0 | \\n | \n |
| file://:0:0:0:0 | \\n | \n |