Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cpp11nullptr committed Dec 22, 2020
1 parent 25ad60e commit 654db2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions tests/std/include/test_regex_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,30 +117,31 @@ class regex_fixture {
}
}

void should_capture_groups(const std::string& subject, const std::string& pattern, const std::vector<std::string>& groups) {
void should_capture_groups(
const std::string& subject, const std::string& pattern, const std::vector<std::string>& groups) {
try {
const std::regex r(pattern);
std::smatch m;

if (!std::regex_match(subject, m, r)) {
printf(R"(Expected regex("%s") to match "%s".)"
"\n",
"\n",
pattern.c_str(), subject.c_str());
fail_regex();
return;
}

if (m[0] != subject) {
printf(R"(should_capture("%s", "%s"): m[0] == "%s")"
"\n",
"\n",
subject.c_str(), pattern.c_str(), m[0].str().c_str());
fail_regex();
}

for (size_t i = 0; i < groups.size(); ++i) {
if (m[i + 1] != groups[i]) {
printf(R"(should_capture("%s", "%s"): m[%zd] == "%s")"
"\n",
"\n",
groups[i].c_str(), pattern.c_str(), i, m[i + 1].str().c_str());
fail_regex();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/std/tests/VSO_0000000_regex_use/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ void test_GH_993_regex_character_class_case_insensitive_search() {
}

void test_GH_731_multiple_matches_to_capture() {
std::vector<std::string> groups{ "AAA", "BBB" };
std::vector<std::string> groups{"AAA", "BBB"};
g_regexTester.should_capture_groups("AAA BBB", R"((A+)\s*(B+)?\s*B*)", groups);
}

Expand Down

0 comments on commit 654db2a

Please sign in to comment.