From 96c7e2dbc5c949745ea5734a19794f17011ce8a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Jul 2026 10:12:21 +0000 Subject: [PATCH] Commit 4: Curate corpus for C++ ECMAScript; regenerate .expected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-only edits to test.cpp to remove Ruby-only syntax that has no C++ ECMAScript equivalent: 1. Removed: "a{,8}" — Ruby-only "{,n}" no-lower-bound quantifier (ECMAScript requires an explicit lower bound in {n,m}) 2. Removed: second ".*" for /.*/m — mode flags in C++ are construction-site arguments (e.g. std::regex::multiline), not part of the pattern string. This mode variant was the exact same pattern string as r_meta1 so it added no coverage. 3. Removed: "(?'foo'fo+)" — Ruby single-quote named-group form. ECMAScript only supports the angle-bracket form (?...). Left in place for now (removed with the parser in commit 5): \\A, \\z, \\G, \\h, \\H — Ruby-only anchor/escape classes. The POSIX-bracket cases are kept through commit 7. .expected regenerated by: codeql test run --learn --search-path=. cpp/ql/test/library-tests/regex/ (CodeQL CLI 2.26.1) All 2 tests passed. --- .../test/library-tests/regex/parse.expected | 24 ------------------- .../test/library-tests/regex/regexp.expected | 14 ----------- cpp/ql/test/library-tests/regex/test.cpp | 6 ++--- 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/cpp/ql/test/library-tests/regex/parse.expected b/cpp/ql/test/library-tests/regex/parse.expected index f5e1a63fbd9..08ed7a2c218 100644 --- a/cpp/ql/test/library-tests/regex/parse.expected +++ b/cpp/ql/test/library-tests/regex/parse.expected @@ -29,11 +29,6 @@ test.cpp: # 35| [RegExpRange] a{4,8} #-----| 0 -> [RegExpConstant, RegExpNormalChar] a -# 36| [RegExpConstant, RegExpNormalChar] a - -# 36| [RegExpRange] a{,8} -#-----| 0 -> [RegExpConstant, RegExpNormalChar] a - # 37| [RegExpConstant, RegExpNormalChar] a # 37| [InfiniteRepetitionQuantifier, RegExpRange] a{3,} @@ -202,11 +197,6 @@ test.cpp: # 59| [RegExpStar] .* #-----| 0 -> [RegExpDot] . -# 60| [RegExpDot] . - -# 60| [RegExpStar] .* -#-----| 0 -> [RegExpDot] . - # 61| [RegExpCharacterClassEscape] \w # 61| [RegExpPlus] \w+ @@ -348,20 +338,6 @@ test.cpp: # 78| [RegExpPlus] \w+ #-----| 0 -> [RegExpCharacterClassEscape] \w -# 79| [RegExpGroup] (?'foo'fo+) -#-----| 0 -> [RegExpSequence] fo+ - -# 79| [RegExpConstant, RegExpNormalChar] f - -# 79| [RegExpSequence] fo+ -#-----| 0 -> [RegExpConstant, RegExpNormalChar] f -#-----| 1 -> [RegExpPlus] o+ - -# 79| [RegExpConstant, RegExpNormalChar] o - -# 79| [RegExpPlus] o+ -#-----| 0 -> [RegExpConstant, RegExpNormalChar] o - # 82| [RegExpGroup] (a+) #-----| 0 -> [RegExpPlus] a+ diff --git a/cpp/ql/test/library-tests/regex/regexp.expected b/cpp/ql/test/library-tests/regex/regexp.expected index 5842f67797f..e2d51ce8f82 100644 --- a/cpp/ql/test/library-tests/regex/regexp.expected +++ b/cpp/ql/test/library-tests/regex/regexp.expected @@ -1,12 +1,10 @@ groupName | test.cpp:78:21:78:30 | (?\\w+) | id | -| test.cpp:79:21:79:31 | (?'foo'fo+) | foo | | test.cpp:83:23:83:32 | (?q+) | qux | groupNumber | test.cpp:72:22:72:26 | (foo) | 1 | | test.cpp:73:24:73:28 | (o\|b) | 1 | | test.cpp:74:22:74:29 | (a\|b\|cd) | 1 | -| test.cpp:79:21:79:31 | (?'foo'fo+) | 1 | | test.cpp:82:23:82:26 | (a+) | 1 | term | test.cpp:31:21:31:23 | abc | RegExpConstant,RegExpNormalChar | @@ -20,8 +18,6 @@ term | test.cpp:34:28:34:28 | d | RegExpConstant,RegExpNormalChar | | test.cpp:35:22:35:22 | a | RegExpConstant,RegExpNormalChar | | test.cpp:35:22:35:27 | a{4,8} | RegExpRange | -| test.cpp:36:22:36:22 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:36:22:36:26 | a{,8} | RegExpRange | | test.cpp:37:22:37:22 | a | RegExpConstant,RegExpNormalChar | | test.cpp:37:22:37:26 | a{3,} | InfiniteRepetitionQuantifier,RegExpRange | | test.cpp:38:22:38:22 | a | RegExpConstant,RegExpNormalChar | @@ -83,8 +79,6 @@ term | test.cpp:56:30:56:33 | A-F] | RegExpConstant,RegExpNormalChar | | test.cpp:59:23:59:23 | . | RegExpDot | | test.cpp:59:23:59:24 | .* | RegExpStar | -| test.cpp:60:24:60:24 | . | RegExpDot | -| test.cpp:60:24:60:25 | .* | RegExpStar | | test.cpp:61:23:61:24 | \\w | RegExpCharacterClassEscape | | test.cpp:61:23:61:25 | \\w+ | RegExpPlus | | test.cpp:61:23:61:27 | \\w+\\W | RegExpSequence | @@ -136,11 +130,6 @@ term | test.cpp:78:21:78:30 | (?\\w+) | RegExpGroup | | test.cpp:78:27:78:28 | \\w | RegExpCharacterClassEscape | | test.cpp:78:27:78:29 | \\w+ | RegExpPlus | -| test.cpp:79:21:79:31 | (?'foo'fo+) | RegExpGroup | -| test.cpp:79:28:79:28 | f | RegExpConstant,RegExpNormalChar | -| test.cpp:79:28:79:30 | fo+ | RegExpSequence | -| test.cpp:79:29:79:29 | o | RegExpConstant,RegExpNormalChar | -| test.cpp:79:29:79:30 | o+ | RegExpPlus | | test.cpp:82:23:82:26 | (a+) | RegExpGroup | | test.cpp:82:23:82:30 | (a+)b+\\1 | RegExpSequence | | test.cpp:82:24:82:24 | a | RegExpConstant,RegExpNormalChar | @@ -193,7 +182,6 @@ regExpNormalCharValue | test.cpp:34:26:34:26 | c | c | | test.cpp:34:28:34:28 | d | d | | test.cpp:35:22:35:22 | a | a | -| test.cpp:36:22:36:22 | a | a | | test.cpp:37:22:37:22 | a | a | | test.cpp:38:22:38:22 | a | a | | test.cpp:41:21:41:23 | foo | foo | @@ -253,8 +241,6 @@ regExpNormalCharValue | test.cpp:75:25:75:25 | : | : | | test.cpp:75:28:75:29 | \\w | w | | test.cpp:78:27:78:28 | \\w | w | -| test.cpp:79:28:79:28 | f | f | -| test.cpp:79:29:79:29 | o | o | | test.cpp:82:24:82:24 | a | a | | test.cpp:82:27:82:27 | b | b | | test.cpp:83:30:83:30 | q | q | diff --git a/cpp/ql/test/library-tests/regex/test.cpp b/cpp/ql/test/library-tests/regex/test.cpp index df580fb10eb..1792e2c5abe 100644 --- a/cpp/ql/test/library-tests/regex/test.cpp +++ b/cpp/ql/test/library-tests/regex/test.cpp @@ -33,7 +33,7 @@ void test() { // Repetition std::regex r_rep1("a*b+c?d"); std::regex r_rep2("a{4,8}"); - std::regex r_rep3("a{,8}"); + // Removed: a{,8} — Ruby-only "{,n}" no-lower-bound quantifier (not in ECMAScript) std::regex r_rep4("a{3,}"); std::regex r_rep5("a{7}"); @@ -57,7 +57,7 @@ void test() { // Meta-character classes std::regex r_meta1(".*"); - std::regex r_meta1m(".*"); // /.*/m mode variant — mode flags are constructor args in C++ + // Removed: /.*/m mode variant — in C++, flags are passed as constructor arg (out of scope) std::regex r_meta2("\\w+\\W"); std::regex r_meta3("\\s\\S"); std::regex r_meta4("\\d\\D"); @@ -76,7 +76,7 @@ void test() { // Named groups std::regex r_ng1("(?\\w+)"); - std::regex r_ng2("(?'foo'fo+)"); // single-quote named-group form + // Removed: (?'foo'fo+) — Ruby single-quote named-group form (not in ECMAScript) // Backreferences std::regex r_bref1("(a+)b+\\1");