[libcxx-commits] [libcxx] [libc++][test][NFC] Clang-format `<regex>` tests (PR #164367)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 20 23:59:00 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: A. Jiang (frederick-vs-ja)

<details>
<summary>Changes</summary>

There is possibly upcoming overhaul for `<regex>`. It would be easier to modify the test files if they are clang-formatted.

Some files are manually adjusted.

Adds clang-format off/on comments to avoid line break:
- libcxx/test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
- libcxx/test/std/re/re.regex/re.regex.construct/deduct.verify.cpp

Adds new lines to avoid ugly grouping for `=`:
- libcxx/test/std/re/re.const/re.matchflag/match_flag_type.pass.cpp
- libcxx/test/std/re/re.const/re.synopt/syntax_option_type.pass.cpp

---

Patch is 1.23 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/164367.diff


173 Files Affected:

- (modified) libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp (+1282-1329) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/basic.compile.fail.cpp (+7-8) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/basic.pass.cpp (+1275-1318) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp (+1347-1354) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/egrep.pass.cpp (+52-57) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/exponential.pass.cpp (+4-9) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/extended.pass.cpp (+1287-1332) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/grep.pass.cpp (+22-25) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp (+39-40) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/lookahead_capture.pass.cpp (+70-71) 
- (modified) libcxx/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp (+29-38) 
- (modified) libcxx/test/std/re/re.alg/re.alg.replace/exponential.pass.cpp (+11-12) 
- (modified) libcxx/test/std/re/re.alg/re.alg.replace/test1.pass.cpp (+92-80) 
- (modified) libcxx/test/std/re/re.alg/re.alg.replace/test2.pass.cpp (+92-80) 
- (modified) libcxx/test/std/re/re.alg/re.alg.replace/test3.pass.cpp (+45-50) 
- (modified) libcxx/test/std/re/re.alg/re.alg.replace/test4.pass.cpp (+41-50) 
- (modified) libcxx/test/std/re/re.alg/re.alg.replace/test5.pass.cpp (+45-50) 
- (modified) libcxx/test/std/re/re.alg/re.alg.replace/test6.pass.cpp (+41-50) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/awk.pass.cpp (+1461-1508) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/backup.pass.cpp (+31-32) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/basic.compile.fail.cpp (+7-8) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/basic.pass.cpp (+1455-1498) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/ecma.pass.cpp (+1517-1522) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/egrep.pass.cpp (+61-66) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/exponential.pass.cpp (+4-9) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/extended.pass.cpp (+1467-1512) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/grep.pass.cpp (+46-52) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp (+1-3) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp (+3-4) 
- (modified) libcxx/test/std/re/re.alg/re.alg.search/no_update_pos.pass.cpp (+15-16) 
- (modified) libcxx/test/std/re/re.alg/re.except/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.badexp/regex_error.pass.cpp (+71-72) 
- (modified) libcxx/test/std/re/re.const/re.err/error_type.pass.cpp (+104-105) 
- (modified) libcxx/test/std/re/re.const/re.matchflag/match_flag_type.pass.cpp (+90-90) 
- (modified) libcxx/test/std/re/re.const/re.matchflag/match_multiline.pass.cpp (+242-248) 
- (modified) libcxx/test/std/re/re.const/re.matchflag/match_not_bol.pass.cpp (+15-16) 
- (modified) libcxx/test/std/re/re.const/re.matchflag/match_not_eol.pass.cpp (+49-50) 
- (modified) libcxx/test/std/re/re.const/re.matchflag/match_not_null.pass.cpp (+10-14) 
- (modified) libcxx/test/std/re/re.const/re.matchflag/match_prev_avail.pass.cpp (+45-45) 
- (modified) libcxx/test/std/re/re.const/re.synopt/syntax_option_type.pass.cpp (+93-93) 
- (modified) libcxx/test/std/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.general/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.grammar/excessive_brace_count.pass.cpp (+4-6) 
- (modified) libcxx/test/std/re/re.grammar/excessive_brace_min_max.pass.cpp (+8-12) 
- (modified) libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.compile.fail.cpp (+6-9) 
- (modified) libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp (+22-23) 
- (modified) libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp (+7-10) 
- (modified) libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp (+22-23) 
- (modified) libcxx/test/std/re/re.iter/re.regiter/types.pass.cpp (+12-15) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.compile.fail.cpp (+9-10) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.pass.cpp (+38-40) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp (+8-11) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.compile.fail.cpp (+8-9) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp (+37-39) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.compile.fail.cpp (+7-9) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.pass.cpp (+49-53) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.compile.fail.cpp (+10-12) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.pass.cpp (+101-105) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.deref/deref.pass.cpp (+49-53) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.incr/post.pass.cpp (+111-116) 
- (modified) libcxx/test/std/re/re.iter/re.tokiter/types.pass.cpp (+12-15) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp (+9-10) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/assign.pass.cpp (+17-15) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp (+21-22) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp (+8-9) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp (+15-16) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp (+9-10) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/copy.pass.cpp (+6-7) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/il.pass.cpp (+5-6) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/ptr.pass.cpp (+5-6) 
- (modified) libcxx/test/std/re/re.regex/re.regex.assign/string.pass.cpp (+5-6) 
- (modified) libcxx/test/std/re/re.regex/re.regex.const/constants.pass.cpp (+26-29) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp (+8-7) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp (+57-60) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/bad_ctype.pass.cpp (+11-13) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp (+19-22) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/bad_range.pass.cpp (+13-15) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp (+18-20) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/copy.pass.cpp (+5-6) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/deduct.pass.cpp (+40-42) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/deduct.verify.cpp (+13-9) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/default.pass.cpp (+7-10) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp (+39-44) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/iter_iter.pass.cpp (+15-18) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp (+34-37) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/ptr.pass.cpp (+9-12) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/ptr_flg.pass.cpp (+34-37) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp (+14-17) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp (+34-38) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/string.pass.cpp (+9-12) 
- (modified) libcxx/test/std/re/re.regex/re.regex.construct/string_flg.pass.cpp (+34-37) 
- (modified) libcxx/test/std/re/re.regex/re.regex.locale/imbue.pass.cpp (+8-9) 
- (modified) libcxx/test/std/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp (+8-9) 
- (modified) libcxx/test/std/re/re.regex/re.regex.operations/tested_elsewhere.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.regex/re.regex.swap/swap.pass.cpp (+8-9) 
- (modified) libcxx/test/std/re/re.regex/types.pass.cpp (+12-14) 
- (modified) libcxx/test/std/re/re.req/nothing_to_do.pass.cpp (+1-5) 
- (modified) libcxx/test/std/re/re.results/range_concept_conformance.compile.pass.cpp (-2) 
- (modified) libcxx/test/std/re/re.results/re.results.acc/begin_end.pass.cpp (+13-16) 
- (modified) libcxx/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp (+13-16) 
- (modified) libcxx/test/std/re/re.results/re.results.acc/index.pass.cpp (+29-32) 
- (modified) libcxx/test/std/re/re.results/re.results.acc/length.pass.cpp (+12-15) 
- (modified) libcxx/test/std/re/re.results/re.results.acc/position.pass.cpp (+12-15) 
- (modified) libcxx/test/std/re/re.results/re.results.acc/prefix.pass.cpp (+10-13) 
- (modified) libcxx/test/std/re/re.results/re.results.acc/str.pass.cpp (+12-15) 
- (modified) libcxx/test/std/re/re.results/re.results.acc/suffix.pass.cpp (+10-13) 
- (modified) libcxx/test/std/re/re.results/re.results.all/get_allocator.pass.cpp (+8-11) 
- (modified) libcxx/test/std/re/re.results/re.results.const/allocator.pass.cpp (+8-11) 
- (modified) libcxx/test/std/re/re.results/re.results.const/copy.pass.cpp (+13-16) 
- (modified) libcxx/test/std/re/re.results/re.results.const/copy_assign.pass.cpp (+21-24) 
- (modified) libcxx/test/std/re/re.results/re.results.const/default.pass.cpp (+12-15) 
- (modified) libcxx/test/std/re/re.results/re.results.const/move.pass.cpp (+19-22) 
- (modified) libcxx/test/std/re/re.results/re.results.const/move_assign.pass.cpp (+21-24) 
- (modified) libcxx/test/std/re/re.results/re.results.form/form1.pass.cpp (+135-130) 
- (modified) libcxx/test/std/re/re.results/re.results.form/form2.pass.cpp (+63-64) 
- (modified) libcxx/test/std/re/re.results/re.results.form/form3.pass.cpp (+51-52) 
- (modified) libcxx/test/std/re/re.results/re.results.form/form4.pass.cpp (+49-50) 
- (modified) libcxx/test/std/re/re.results/re.results.nonmember/equal.pass.cpp (+11-14) 
- (modified) libcxx/test/std/re/re.results/re.results.size/empty.pass.cpp (+10-13) 
- (modified) libcxx/test/std/re/re.results/re.results.size/empty.verify.cpp (+2-2) 
- (modified) libcxx/test/std/re/re.results/re.results.size/max_size.pass.cpp (+6-9) 
- (modified) libcxx/test/std/re/re.results/re.results.state/ready.pass.cpp (+15-20) 
- (modified) libcxx/test/std/re/re.results/re.results.swap/member_swap.pass.cpp (+12-15) 
- (modified) libcxx/test/std/re/re.results/re.results.swap/non_member_swap.pass.cpp (+12-15) 
- (modified) libcxx/test/std/re/re.results/types.pass.cpp (+14-17) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp (+27-28) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.members/compare_sub_match.pass.cpp (+33-34) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp (+25-26) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.members/default.pass.cpp (+13-14) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.members/length.pass.cpp (+23-24) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.members/operator_string.pass.cpp (+27-28) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.members/str.pass.cpp (+27-28) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.op/compare.pass.cpp (+55-47) 
- (modified) libcxx/test/std/re/re.submatch/re.submatch.op/stream.pass.cpp (+14-17) 
- (modified) libcxx/test/std/re/re.submatch/types.pass.cpp (+29-30) 
- (modified) libcxx/test/std/re/re.syn/cmatch.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/cregex_iterator.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/cregex_token_iterator.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/csub_match.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/regex.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/smatch.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/sregex_iterator.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/sregex_token_iterator.pass.cpp (+3-3) 
- (modified) libcxx/test/std/re/re.syn/ssub_match.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/wcmatch.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/wcregex_iterator.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/wcregex_token_iterator.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/wcsub_match.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/wregex.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/wsmatch.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/wsregex_iterator.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.syn/wsregex_token_iterator.pass.cpp (+3-3) 
- (modified) libcxx/test/std/re/re.syn/wssub_match.pass.cpp (+2-3) 
- (modified) libcxx/test/std/re/re.traits/default.pass.cpp (+19-20) 
- (modified) libcxx/test/std/re/re.traits/getloc.pass.cpp (+19-20) 
- (modified) libcxx/test/std/re/re.traits/imbue.pass.cpp (+7-8) 
- (modified) libcxx/test/std/re/re.traits/isctype.pass.cpp (+259-261) 
- (modified) libcxx/test/std/re/re.traits/length.pass.cpp (+9-10) 
- (modified) libcxx/test/std/re/re.traits/lookup_classname.pass.cpp (+199-216) 
- (modified) libcxx/test/std/re/re.traits/lookup_collatename.pass.cpp (+143-150) 
- (modified) libcxx/test/std/re/re.traits/transform.pass.cpp (+19-20) 
- (modified) libcxx/test/std/re/re.traits/transform_primary.pass.cpp (+19-24) 
- (modified) libcxx/test/std/re/re.traits/translate.pass.cpp (+13-14) 
- (modified) libcxx/test/std/re/re.traits/translate_nocase.pass.cpp (+39-40) 
- (modified) libcxx/test/std/re/re.traits/types.pass.cpp (+7-8) 
- (modified) libcxx/test/std/re/re.traits/value.pass.cpp (+85-102) 


``````````diff
diff --git a/libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp
index 024738258c050..ef906ff21d3f1 100644
--- a/libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp
+++ b/libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp
@@ -21,1336 +21,1289 @@
 #include "test_macros.h"
 #include "test_iterators.h"
 
-int main(int, char**)
-{
-    {
-        std::cmatch m;
-        const char s[] = "a";
-        assert(std::regex_match(s, m, std::regex("a", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.empty());
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+1);
-        assert(m.length(0) == 1);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == "a");
-    }
-    {
-        std::cmatch m;
-        const char s[] = "ab";
-        assert(std::regex_match(s, m, std::regex("ab", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+2);
-        assert(m.length(0) == 2);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == "ab");
-    }
-    {
-        std::cmatch m;
-        const char s[] = "ab";
-        assert(!std::regex_match(s, m, std::regex("ba", std::regex_constants::awk)));
-        assert(m.size() == 0);
-        assert(m.empty());
-    }
-    {
-        std::cmatch m;
-        const char s[] = "aab";
-        assert(!std::regex_match(s, m, std::regex("ab", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "aab";
-        assert(!std::regex_match(s, m, std::regex("ab", std::regex_constants::awk),
-                                            std::regex_constants::match_continuous));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abcd";
-        assert(!std::regex_match(s, m, std::regex("bc", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abbc";
-        assert(std::regex_match(s, m, std::regex("ab*c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+4);
-        assert(m.length(0) == 4);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "ababc";
-        assert(std::regex_match(s, m, std::regex("(ab)*c", std::regex_constants::awk)));
-        assert(m.size() == 2);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+5);
-        assert(m.length(0) == 5);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-        assert(m.length(1) == 2);
-        assert(m.position(1) == 2);
-        assert(m.str(1) == "ab");
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abcdefghijk";
-        assert(!std::regex_match(s, m, std::regex("cd((e)fg)hi",
-                                 std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abc";
-        assert(std::regex_match(s, m, std::regex("^abc", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+3);
-        assert(m.length(0) == 3);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abcd";
-        assert(!std::regex_match(s, m, std::regex("^abc", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "aabc";
-        assert(!std::regex_match(s, m, std::regex("^abc", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abc";
-        assert(std::regex_match(s, m, std::regex("abc$", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+3);
-        assert(m.length(0) == 3);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "efabc";
-        assert(!std::regex_match(s, m, std::regex("abc$", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "efabcg";
-        assert(!std::regex_match(s, m, std::regex("abc$", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abc";
-        assert(std::regex_match(s, m, std::regex("a.c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+3);
-        assert(m.length(0) == 3);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "acc";
-        assert(std::regex_match(s, m, std::regex("a.c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+3);
-        assert(m.length(0) == 3);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "acc";
-        assert(std::regex_match(s, m, std::regex("a.c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+3);
-        assert(m.length(0) == 3);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abcdef";
-        assert(std::regex_match(s, m, std::regex("(.*).*", std::regex_constants::awk)));
-        assert(m.size() == 2);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == s+6);
-        assert(m.length(0) == 6);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-        assert(m.length(1) == 6);
-        assert(m.position(1) == 0);
-        assert(m.str(1) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "bc";
-        assert(!std::regex_match(s, m, std::regex("(a*)*", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abbc";
-        assert(!std::regex_match(s, m, std::regex("ab{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abbbc";
-        assert(std::regex_match(s, m, std::regex("ab{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abbbbc";
-        assert(std::regex_match(s, m, std::regex("ab{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abbbbbc";
-        assert(std::regex_match(s, m, std::regex("ab{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "adefc";
-        assert(!std::regex_match(s, m, std::regex("ab{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "abbbbbbc";
-        assert(!std::regex_match(s, m, std::regex("ab{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "adec";
-        assert(!std::regex_match(s, m, std::regex("a.{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "adefc";
-        assert(std::regex_match(s, m, std::regex("a.{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "adefgc";
-        assert(std::regex_match(s, m, std::regex("a.{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "adefghc";
-        assert(std::regex_match(s, m, std::regex("a.{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "adefghic";
-        assert(!std::regex_match(s, m, std::regex("a.{3,5}c", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "tournament";
-        assert(std::regex_match(s, m, std::regex("tour|to|tournament",
-                                              std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "tournamenttotour";
-        assert(std::regex_match(s, m, std::regex("(tour|to|tournament)+",
-               std::regex_constants::awk | std::regex_constants::nosubs)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "ttotour";
-        assert(std::regex_match(s, m, std::regex("(tour|to|t)+",
-                                              std::regex_constants::awk)));
-        assert(m.size() == 2);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-        assert(m.length(1) == 4);
-        assert(m.position(1) == 3);
-        assert(m.str(1) == "tour");
-    }
-    {
-        std::cmatch m;
-        const char s[] = "-ab,ab-";
-        assert(!std::regex_match(s, m, std::regex("-(.*),\1-", std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "-ab,ab-";
-        assert(std::regex_match(s, m, std::regex("-.*,.*-", std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "a";
-        assert(std::regex_match(s, m, std::regex("^[a]$",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert(m.length(0) == 1);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == "a");
-    }
-    {
-        std::cmatch m;
-        const char s[] = "a";
-        assert(std::regex_match(s, m, std::regex("^[ab]$",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert(m.length(0) == 1);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == "a");
-    }
-    {
-        std::cmatch m;
-        const char s[] = "c";
-        assert(std::regex_match(s, m, std::regex("^[a-f]$",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert(m.length(0) == 1);
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "g";
-        assert(!std::regex_match(s, m, std::regex("^[a-f]$",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "Iraqi";
-        assert(!std::regex_match(s, m, std::regex("q[^u]",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "Iraq";
-        assert(!std::regex_match(s, m, std::regex("q[^u]",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "AmB";
-        assert(std::regex_match(s, m, std::regex("A[[:lower:]]B",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "AMB";
-        assert(!std::regex_match(s, m, std::regex("A[[:lower:]]B",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "AMB";
-        assert(std::regex_match(s, m, std::regex("A[^[:lower:]]B",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 1);
-        assert(!m.prefix().matched);
-        assert(m.prefix().first == s);
-        assert(m.prefix().second == m[0].first);
-        assert(!m.suffix().matched);
-        assert(m.suffix().first == m[0].second);
-        assert(m.suffix().second == m[0].second);
-        assert((std::size_t)m.length(0) == std::char_traits<char>::length(s));
-        assert(m.position(0) == 0);
-        assert(m.str(0) == s);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "AmB";
-        assert(!std::regex_match(s, m, std::regex("A[^[:lower:]]B",
-                                                 std::regex_constants::awk)));
-        assert(m.size() == 0);
-    }
-    {
-        std::cmatch m;
-        const char s[] = "A5B";
-        assert(!std::regex_match(s, m, std::regex("A[^[:lower:]0-9]B",
-                                                 std::regex...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/164367


More information about the libcxx-commits mailing list