From acda53a203a3a31106cd9c1cdb15d4dd12dc714e Mon Sep 17 00:00:00 2001 From: Max Sagebaum Date: Tue, 13 Aug 2024 18:13:06 +0200 Subject: [PATCH] Update for sanitizing regex results and matcher strings. --- .../pure2-regex_01_char_matcher.cpp2 | 16 +- regression-tests/pure2-regex_02_ranges.cpp2 | 16 +- regression-tests/pure2-regex_03_wildcard.cpp2 | 16 +- .../pure2-regex_04_start_end.cpp2 | 16 +- regression-tests/pure2-regex_05_classes.cpp2 | 16 +- .../pure2-regex_06_boundaries.cpp2 | 16 +- .../pure2-regex_07_short_classes.cpp2 | 16 +- .../pure2-regex_08_alternatives.cpp2 | 16 +- regression-tests/pure2-regex_09_groups.cpp2 | 16 +- regression-tests/pure2-regex_10_escapes.cpp2 | 16 +- .../pure2-regex_11_group_references.cpp2 | 16 +- .../pure2-regex_12_case_insensitive.cpp2 | 16 +- .../pure2-regex_13_possessive_modifier.cpp2 | 16 +- .../pure2-regex_14_multiline_modifier.cpp2 | 16 +- .../pure2-regex_15_group_modifiers.cpp2 | 16 +- .../pure2-regex_16_perl_syntax_modifier.cpp2 | 16 +- regression-tests/pure2-regex_17_comments.cpp2 | 16 +- .../pure2-regex_18_branch_reset.cpp2 | 16 +- .../pure2-regex_19_lookahead.cpp2 | 16 +- .../pure2-regex_10_escapes.cpp.execution | 43 +- ...-regex_14_multiline_modifier.cpp.execution | 730 +++++------------- ...re2-regex_15_group_modifiers.cpp.execution | 62 +- .../pure2-regex_19_lookahead.cpp.execution | 44 +- .../pure2-regex_10_escapes.cpp.execution | 26 +- .../pure2-regex_01_char_matcher.cpp | 32 +- .../test-results/pure2-regex_02_ranges.cpp | 32 +- .../test-results/pure2-regex_03_wildcard.cpp | 32 +- .../test-results/pure2-regex_04_start_end.cpp | 32 +- .../test-results/pure2-regex_05_classes.cpp | 32 +- .../pure2-regex_06_boundaries.cpp | 32 +- .../pure2-regex_07_short_classes.cpp | 32 +- .../pure2-regex_08_alternatives.cpp | 32 +- .../test-results/pure2-regex_09_groups.cpp | 32 +- .../test-results/pure2-regex_10_escapes.cpp | 32 +- .../pure2-regex_11_group_references.cpp | 32 +- .../pure2-regex_12_case_insensitive.cpp | 32 +- .../pure2-regex_13_possessive_modifier.cpp | 32 +- .../pure2-regex_14_multiline_modifier.cpp | 32 +- .../pure2-regex_15_group_modifiers.cpp | 32 +- .../pure2-regex_16_perl_syntax_modifier.cpp | 32 +- .../test-results/pure2-regex_17_comments.cpp | 32 +- .../pure2-regex_18_branch_reset.cpp | 32 +- .../test-results/pure2-regex_19_lookahead.cpp | 32 +- 43 files changed, 969 insertions(+), 848 deletions(-) diff --git a/regression-tests/pure2-regex_01_char_matcher.cpp2 b/regression-tests/pure2-regex_01_char_matcher.cpp2 index 0d965a40e..9324ef19a 100644 --- a/regression-tests/pure2-regex_01_char_matcher.cpp2 +++ b/regression-tests/pure2-regex_01_char_matcher.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_02_ranges.cpp2 b/regression-tests/pure2-regex_02_ranges.cpp2 index a122bdcf0..b3982da32 100644 --- a/regression-tests/pure2-regex_02_ranges.cpp2 +++ b/regression-tests/pure2-regex_02_ranges.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_03_wildcard.cpp2 b/regression-tests/pure2-regex_03_wildcard.cpp2 index 6f5ec0236..1c5804171 100644 --- a/regression-tests/pure2-regex_03_wildcard.cpp2 +++ b/regression-tests/pure2-regex_03_wildcard.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_04_start_end.cpp2 b/regression-tests/pure2-regex_04_start_end.cpp2 index 31db32c85..c564ff59f 100644 --- a/regression-tests/pure2-regex_04_start_end.cpp2 +++ b/regression-tests/pure2-regex_04_start_end.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_05_classes.cpp2 b/regression-tests/pure2-regex_05_classes.cpp2 index 8be092235..2ae55e99a 100644 --- a/regression-tests/pure2-regex_05_classes.cpp2 +++ b/regression-tests/pure2-regex_05_classes.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_06_boundaries.cpp2 b/regression-tests/pure2-regex_06_boundaries.cpp2 index fdef8e1c3..df4ddd91e 100644 --- a/regression-tests/pure2-regex_06_boundaries.cpp2 +++ b/regression-tests/pure2-regex_06_boundaries.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_07_short_classes.cpp2 b/regression-tests/pure2-regex_07_short_classes.cpp2 index 8e9b5b024..933ce437e 100644 --- a/regression-tests/pure2-regex_07_short_classes.cpp2 +++ b/regression-tests/pure2-regex_07_short_classes.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_08_alternatives.cpp2 b/regression-tests/pure2-regex_08_alternatives.cpp2 index 0ff9f7c67..8be74d558 100644 --- a/regression-tests/pure2-regex_08_alternatives.cpp2 +++ b/regression-tests/pure2-regex_08_alternatives.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_09_groups.cpp2 b/regression-tests/pure2-regex_09_groups.cpp2 index 580391b51..b58e069b6 100644 --- a/regression-tests/pure2-regex_09_groups.cpp2 +++ b/regression-tests/pure2-regex_09_groups.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_10_escapes.cpp2 b/regression-tests/pure2-regex_10_escapes.cpp2 index 17d56a0c1..7546a82f3 100644 --- a/regression-tests/pure2-regex_10_escapes.cpp2 +++ b/regression-tests/pure2-regex_10_escapes.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_11_group_references.cpp2 b/regression-tests/pure2-regex_11_group_references.cpp2 index 076f98d77..ad987caa0 100644 --- a/regression-tests/pure2-regex_11_group_references.cpp2 +++ b/regression-tests/pure2-regex_11_group_references.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_12_case_insensitive.cpp2 b/regression-tests/pure2-regex_12_case_insensitive.cpp2 index a6610b10e..e777c9697 100644 --- a/regression-tests/pure2-regex_12_case_insensitive.cpp2 +++ b/regression-tests/pure2-regex_12_case_insensitive.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_13_possessive_modifier.cpp2 b/regression-tests/pure2-regex_13_possessive_modifier.cpp2 index 774cd79dc..17aeabc30 100644 --- a/regression-tests/pure2-regex_13_possessive_modifier.cpp2 +++ b/regression-tests/pure2-regex_13_possessive_modifier.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_14_multiline_modifier.cpp2 b/regression-tests/pure2-regex_14_multiline_modifier.cpp2 index a48e3e4d5..35d6896c0 100644 --- a/regression-tests/pure2-regex_14_multiline_modifier.cpp2 +++ b/regression-tests/pure2-regex_14_multiline_modifier.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_15_group_modifiers.cpp2 b/regression-tests/pure2-regex_15_group_modifiers.cpp2 index d0db986c9..7c0600a7d 100644 --- a/regression-tests/pure2-regex_15_group_modifiers.cpp2 +++ b/regression-tests/pure2-regex_15_group_modifiers.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_16_perl_syntax_modifier.cpp2 b/regression-tests/pure2-regex_16_perl_syntax_modifier.cpp2 index c586d1fc0..d8b41f549 100644 --- a/regression-tests/pure2-regex_16_perl_syntax_modifier.cpp2 +++ b/regression-tests/pure2-regex_16_perl_syntax_modifier.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_17_comments.cpp2 b/regression-tests/pure2-regex_17_comments.cpp2 index 00c3c96a9..138913a84 100644 --- a/regression-tests/pure2-regex_17_comments.cpp2 +++ b/regression-tests/pure2-regex_17_comments.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_18_branch_reset.cpp2 b/regression-tests/pure2-regex_18_branch_reset.cpp2 index 7d79aec1a..338e9bfe1 100644 --- a/regression-tests/pure2-regex_18_branch_reset.cpp2 +++ b/regression-tests/pure2-regex_18_branch_reset.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/pure2-regex_19_lookahead.cpp2 b/regression-tests/pure2-regex_19_lookahead.cpp2 index 209d0eb8d..14bec3a73 100644 --- a/regression-tests/pure2-regex_19_lookahead.cpp2 +++ b/regression-tests/pure2-regex_19_lookahead.cpp2 @@ -109,6 +109,18 @@ create_result: (resultExpr: std::string, r) -> std::string = { return result; } +sanitize: (copy str: std::string) -> std::string = +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return str; +} + test: (regex: M, id: std::string, regex_str: std::string, str: std::string, kind: std::string, resultExpr: std::string, resultExpected: std::string) = { @@ -131,7 +143,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, result := create_result(resultExpr, r); if result != resultExpected { - status = "Failure: Result is wrong. (is: (result)$)"; + status = "Failure: Result is wrong. (is: (sanitize(result))$)"; } } } @@ -146,7 +158,7 @@ test: (regex: M, id: std::string, regex_str: std::string, str: std::string, if !warning.empty() { warning += " "; } - std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (str)$ result_expr: (resultExpr)$ expected_results (resultExpected)$" << std::endl; + std::cout << "(id)$_(kind)$: (status)$ (warning)$regex: (regex_str)$ parsed_regex: (regex.to_string())$ str: (sanitize(str))$ result_expr: (resultExpr)$ expected_results (sanitize(resultExpected))$" << std::endl; } diff --git a/regression-tests/test-results/gcc-13-c++2b/pure2-regex_10_escapes.cpp.execution b/regression-tests/test-results/gcc-13-c++2b/pure2-regex_10_escapes.cpp.execution index fe6e6efc9..7f23465cb 100644 --- a/regression-tests/test-results/gcc-13-c++2b/pure2-regex_10_escapes.cpp.execution +++ b/regression-tests/test-results/gcc-13-c++2b/pure2-regex_10_escapes.cpp.execution @@ -3,36 +3,19 @@ Running tests_10_escapes: 02_y: OK regex: a\(*b parsed_regex: a\(*b str: ab result_expr: $& expected_results ab 03_y: OK regex: a\(*b parsed_regex: a\(*b str: a((b result_expr: $& expected_results a((b 04_y: OK regex: a\\b parsed_regex: a\\b str: a\b result_expr: $& expected_results a\b -05_y: OK regex: foo(\h+)bar parsed_regex: foo(\h+)bar str: foo bar result_expr: $1 expected_results -06_y: OK regex: (\H+)(\h) parsed_regex: (\H+)(\h) str: foo bar result_expr: $1-$2 expected_results foo- -07_y: OK regex: (\h+)(\H) parsed_regex: (\h+)(\H) str: foo bar result_expr: $1-$2 expected_results -b -08_y: OK regex: foo(\h)bar parsed_regex: foo(\h)bar str: foo bar result_expr: $1 expected_results -09_y: OK regex: (\H)(\h) parsed_regex: (\H)(\h) str: foo bar result_expr: $1-$2 expected_results o- -10_y: OK regex: (\h)(\H) parsed_regex: (\h)(\H) str: foo bar result_expr: $1-$2 expected_results -b -11_y: OK regex: foo(\v+)bar parsed_regex: foo(\v+)bar str: foo - - -bar result_expr: $1 expected_results - - - -12_y: OK regex: (\V+)(\v) parsed_regex: (\V+)(\v) str: foo - - -bar result_expr: $1-$2 expected_results foo- -13_y: OK regex: (\v+)(\V) parsed_regex: (\v+)(\V) str: foo - - -bar result_expr: $1-$2 expected_results - - --b -14_y: OK regex: foo(\v)bar parsed_regex: foo(\v)bar str: foo bar result_expr: $1 expected_results -15_y: OK regex: (\V)(\v) parsed_regex: (\V)(\v) str: foo bar result_expr: $1-$2 expected_results o- -16_y: OK regex: (\v)(\V) parsed_regex: (\v)(\V) str: foo bar result_expr: $1-$2 expected_results -b -17_y: OK regex: foo\t\n\r\f\a\ebar parsed_regex: foo\t\n\r\f\a\ebar str: foo - bar result_expr: $& expected_results foo - bar +05_y: OK regex: foo(\h+)bar parsed_regex: foo(\h+)bar str: foo\tbar result_expr: $1 expected_results \t +06_y: OK regex: (\H+)(\h) parsed_regex: (\H+)(\h) str: foo\tbar result_expr: $1-$2 expected_results foo-\t +07_y: OK regex: (\h+)(\H) parsed_regex: (\h+)(\H) str: foo\tbar result_expr: $1-$2 expected_results \t-b +08_y: OK regex: foo(\h)bar parsed_regex: foo(\h)bar str: foo\tbar result_expr: $1 expected_results \t +09_y: OK regex: (\H)(\h) parsed_regex: (\H)(\h) str: foo\tbar result_expr: $1-$2 expected_results o-\t +10_y: OK regex: (\h)(\H) parsed_regex: (\h)(\H) str: foo\tbar result_expr: $1-$2 expected_results \t-b +11_y: OK regex: foo(\v+)bar parsed_regex: foo(\v+)bar str: foo\r\n\r\n\nbar result_expr: $1 expected_results \r\n\r\n\n +12_y: OK regex: (\V+)(\v) parsed_regex: (\V+)(\v) str: foo\r\n\r\n\nbar result_expr: $1-$2 expected_results foo-\r +13_y: OK regex: (\v+)(\V) parsed_regex: (\v+)(\V) str: foo\r\n\r\n\nbar result_expr: $1-$2 expected_results \r\n\r\n\n-b +14_y: OK regex: foo(\v)bar parsed_regex: foo(\v)bar str: foo\rbar result_expr: $1 expected_results \r +15_y: OK regex: (\V)(\v) parsed_regex: (\V)(\v) str: foo\rbar result_expr: $1-$2 expected_results o-\r +16_y: OK regex: (\v)(\V) parsed_regex: (\v)(\V) str: foo\rbar result_expr: $1-$2 expected_results \r-b +17_y: OK regex: foo\t\n\r\f\a\ebar parsed_regex: foo\t\n\r\f\a\ebar str: foo\t\n\r\f\a\ebar result_expr: $& expected_results foo\t\n\r\f\a\ebar 18_y: OK regex: foo\Kbar parsed_regex: foo\Kbar str: foobar result_expr: $& expected_results bar 19_y: OK regex: \x41\x42 parsed_regex: \x41\x42 str: AB result_expr: $& expected_results AB 20_y: OK regex: \101\o{102} parsed_regex: \101\o{102} str: AB result_expr: $& expected_results AB diff --git a/regression-tests/test-results/gcc-13-c++2b/pure2-regex_14_multiline_modifier.cpp.execution b/regression-tests/test-results/gcc-13-c++2b/pure2-regex_14_multiline_modifier.cpp.execution index 9a12081ac..f75692392 100644 --- a/regression-tests/test-results/gcc-13-c++2b/pure2-regex_14_multiline_modifier.cpp.execution +++ b/regression-tests/test-results/gcc-13-c++2b/pure2-regex_14_multiline_modifier.cpp.execution @@ -1,533 +1,201 @@ Running tests_14_multiline_modifier: -01_y: OK regex: \Z parsed_regex: \Z str: a -b - result_expr: $-[0] expected_results 3 -02_y: OK regex: \z parsed_regex: \z str: a -b - result_expr: $-[0] expected_results 4 -03_y: OK regex: $ parsed_regex: $ str: a -b - result_expr: $-[0] expected_results 3 -04_y: OK regex: \Z parsed_regex: \Z str: b -a - result_expr: $-[0] expected_results 3 -05_y: OK regex: \z parsed_regex: \z str: b -a - result_expr: $-[0] expected_results 4 -06_y: OK regex: $ parsed_regex: $ str: b -a - result_expr: $-[0] expected_results 3 -07_y: OK regex: \Z parsed_regex: \Z str: b -a result_expr: $-[0] expected_results 3 -08_y: OK regex: \z parsed_regex: \z str: b -a result_expr: $-[0] expected_results 3 -09_y: OK regex: $ parsed_regex: $ str: b -a result_expr: $-[0] expected_results 3 -10_y: OK regex: '\Z'm parsed_regex: '\Z'm str: a -b - result_expr: $-[0] expected_results 3 -11_y: OK regex: '\z'm parsed_regex: '\z'm str: a -b - result_expr: $-[0] expected_results 4 -12_y: OK regex: '$'m parsed_regex: '$'m str: a -b - result_expr: $-[0] expected_results 1 -13_y: OK regex: '\Z'm parsed_regex: '\Z'm str: b -a - result_expr: $-[0] expected_results 3 -14_y: OK regex: '\z'm parsed_regex: '\z'm str: b -a - result_expr: $-[0] expected_results 4 -15_y: OK regex: '$'m parsed_regex: '$'m str: b -a - result_expr: $-[0] expected_results 1 -16_y: OK regex: '\Z'm parsed_regex: '\Z'm str: b -a result_expr: $-[0] expected_results 3 -17_y: OK regex: '\z'm parsed_regex: '\z'm str: b -a result_expr: $-[0] expected_results 3 -18_y: OK regex: '$'m parsed_regex: '$'m str: b -a result_expr: $-[0] expected_results 1 -19_n: OK regex: a\Z parsed_regex: a\Z str: a -b - result_expr: - expected_results - -20_n: OK regex: a\z parsed_regex: a\z str: a -b - result_expr: - expected_results - -21_n: OK regex: a$ parsed_regex: a$ str: a -b - result_expr: - expected_results - -22_y: OK regex: a\Z parsed_regex: a\Z str: b -a - result_expr: $-[0] expected_results 2 -23_n: OK regex: a\z parsed_regex: a\z str: b -a - result_expr: - expected_results - -24_y: OK regex: a$ parsed_regex: a$ str: b -a - result_expr: $-[0] expected_results 2 -25_y: OK regex: a\Z parsed_regex: a\Z str: b -a result_expr: $-[0] expected_results 2 -26_y: OK regex: a\z parsed_regex: a\z str: b -a result_expr: $-[0] expected_results 2 -27_y: OK regex: a$ parsed_regex: a$ str: b -a result_expr: $-[0] expected_results 2 -28_n: OK regex: 'a\Z'm parsed_regex: 'a\Z'm str: a -b - result_expr: - expected_results - -29_n: OK regex: 'a\z'm parsed_regex: 'a\z'm str: a -b - result_expr: - expected_results - -30_y: OK regex: 'a$'m parsed_regex: 'a$'m str: a -b - result_expr: $-[0] expected_results 0 -31_y: OK regex: 'a\Z'm parsed_regex: 'a\Z'm str: b -a - result_expr: $-[0] expected_results 2 -32_n: OK regex: 'a\z'm parsed_regex: 'a\z'm str: b -a - result_expr: - expected_results - -33_y: OK regex: 'a$'m parsed_regex: 'a$'m str: b -a - result_expr: $-[0] expected_results 2 -34_y: OK regex: 'a\Z'm parsed_regex: 'a\Z'm str: b -a result_expr: $-[0] expected_results 2 -35_y: OK regex: 'a\z'm parsed_regex: 'a\z'm str: b -a result_expr: $-[0] expected_results 2 -36_y: OK regex: 'a$'m parsed_regex: 'a$'m str: b -a result_expr: $-[0] expected_results 2 -37_n: OK regex: aa\Z parsed_regex: aa\Z str: aa -b - result_expr: - expected_results - -38_n: OK regex: aa\z parsed_regex: aa\z str: aa -b - result_expr: - expected_results - -39_n: OK regex: aa$ parsed_regex: aa$ str: aa -b - result_expr: - expected_results - -40_y: OK regex: aa\Z parsed_regex: aa\Z str: b -aa - result_expr: $-[0] expected_results 2 -41_n: OK regex: aa\z parsed_regex: aa\z str: b -aa - result_expr: - expected_results - -42_y: OK regex: aa$ parsed_regex: aa$ str: b -aa - result_expr: $-[0] expected_results 2 -43_y: OK regex: aa\Z parsed_regex: aa\Z str: b -aa result_expr: $-[0] expected_results 2 -44_y: OK regex: aa\z parsed_regex: aa\z str: b -aa result_expr: $-[0] expected_results 2 -45_y: OK regex: aa$ parsed_regex: aa$ str: b -aa result_expr: $-[0] expected_results 2 -46_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: aa -b - result_expr: - expected_results - -47_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: aa -b - result_expr: - expected_results - -48_y: OK regex: 'aa$'m parsed_regex: 'aa$'m str: aa -b - result_expr: $-[0] expected_results 0 -49_y: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b -aa - result_expr: $-[0] expected_results 2 -50_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b -aa - result_expr: - expected_results - -51_y: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b -aa - result_expr: $-[0] expected_results 2 -52_y: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b -aa result_expr: $-[0] expected_results 2 -53_y: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b -aa result_expr: $-[0] expected_results 2 -54_y: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b -aa result_expr: $-[0] expected_results 2 -55_n: OK regex: aa\Z parsed_regex: aa\Z str: ac -b - result_expr: - expected_results - -56_n: OK regex: aa\z parsed_regex: aa\z str: ac -b - result_expr: - expected_results - -57_n: OK regex: aa$ parsed_regex: aa$ str: ac -b - result_expr: - expected_results - -58_n: OK regex: aa\Z parsed_regex: aa\Z str: b -ac - result_expr: - expected_results - -59_n: OK regex: aa\z parsed_regex: aa\z str: b -ac - result_expr: - expected_results - -60_n: OK regex: aa$ parsed_regex: aa$ str: b -ac - result_expr: - expected_results - -61_n: OK regex: aa\Z parsed_regex: aa\Z str: b -ac result_expr: - expected_results - -62_n: OK regex: aa\z parsed_regex: aa\z str: b -ac result_expr: - expected_results - -63_n: OK regex: aa$ parsed_regex: aa$ str: b -ac result_expr: - expected_results - -64_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: ac -b - result_expr: - expected_results - -65_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: ac -b - result_expr: - expected_results - -66_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: ac -b - result_expr: - expected_results - -67_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b -ac - result_expr: - expected_results - -68_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b -ac - result_expr: - expected_results - -69_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b -ac - result_expr: - expected_results - -70_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b -ac result_expr: - expected_results - -71_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b -ac result_expr: - expected_results - -72_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b -ac result_expr: - expected_results - -73_n: OK regex: aa\Z parsed_regex: aa\Z str: ca -b - result_expr: - expected_results - -74_n: OK regex: aa\z parsed_regex: aa\z str: ca -b - result_expr: - expected_results - -75_n: OK regex: aa$ parsed_regex: aa$ str: ca -b - result_expr: - expected_results - -76_n: OK regex: aa\Z parsed_regex: aa\Z str: b -ca - result_expr: - expected_results - -77_n: OK regex: aa\z parsed_regex: aa\z str: b -ca - result_expr: - expected_results - -78_n: OK regex: aa$ parsed_regex: aa$ str: b -ca - result_expr: - expected_results - -79_n: OK regex: aa\Z parsed_regex: aa\Z str: b -ca result_expr: - expected_results - -80_n: OK regex: aa\z parsed_regex: aa\z str: b -ca result_expr: - expected_results - -81_n: OK regex: aa$ parsed_regex: aa$ str: b -ca result_expr: - expected_results - -82_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: ca -b - result_expr: - expected_results - -83_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: ca -b - result_expr: - expected_results - -84_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: ca -b - result_expr: - expected_results - -85_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b -ca - result_expr: - expected_results - -86_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b -ca - result_expr: - expected_results - -87_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b -ca - result_expr: - expected_results - -88_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b -ca result_expr: - expected_results - -89_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b -ca result_expr: - expected_results - -90_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b -ca result_expr: - expected_results - -91_n: OK regex: ab\Z parsed_regex: ab\Z str: ab -b - result_expr: - expected_results - -92_n: OK regex: ab\z parsed_regex: ab\z str: ab -b - result_expr: - expected_results - -93_n: OK regex: ab$ parsed_regex: ab$ str: ab -b - result_expr: - expected_results - -94_y: OK regex: ab\Z parsed_regex: ab\Z str: b -ab - result_expr: $-[0] expected_results 2 -95_n: OK regex: ab\z parsed_regex: ab\z str: b -ab - result_expr: - expected_results - -96_y: OK regex: ab$ parsed_regex: ab$ str: b -ab - result_expr: $-[0] expected_results 2 -97_y: OK regex: ab\Z parsed_regex: ab\Z str: b -ab result_expr: $-[0] expected_results 2 -98_y: OK regex: ab\z parsed_regex: ab\z str: b -ab result_expr: $-[0] expected_results 2 -99_y: OK regex: ab$ parsed_regex: ab$ str: b -ab result_expr: $-[0] expected_results 2 -100_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: ab -b - result_expr: - expected_results - -101_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: ab -b - result_expr: - expected_results - -102_y: OK regex: 'ab$'m parsed_regex: 'ab$'m str: ab -b - result_expr: $-[0] expected_results 0 -103_y: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b -ab - result_expr: $-[0] expected_results 2 -104_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b -ab - result_expr: - expected_results - -105_y: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b -ab - result_expr: $-[0] expected_results 2 -106_y: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b -ab result_expr: $-[0] expected_results 2 -107_y: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b -ab result_expr: $-[0] expected_results 2 -108_y: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b -ab result_expr: $-[0] expected_results 2 -109_n: OK regex: ab\Z parsed_regex: ab\Z str: ac -b - result_expr: - expected_results - -110_n: OK regex: ab\z parsed_regex: ab\z str: ac -b - result_expr: - expected_results - -111_n: OK regex: ab$ parsed_regex: ab$ str: ac -b - result_expr: - expected_results - -112_n: OK regex: ab\Z parsed_regex: ab\Z str: b -ac - result_expr: - expected_results - -113_n: OK regex: ab\z parsed_regex: ab\z str: b -ac - result_expr: - expected_results - -114_n: OK regex: ab$ parsed_regex: ab$ str: b -ac - result_expr: - expected_results - -115_n: OK regex: ab\Z parsed_regex: ab\Z str: b -ac result_expr: - expected_results - -116_n: OK regex: ab\z parsed_regex: ab\z str: b -ac result_expr: - expected_results - -117_n: OK regex: ab$ parsed_regex: ab$ str: b -ac result_expr: - expected_results - -118_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: ac -b - result_expr: - expected_results - -119_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: ac -b - result_expr: - expected_results - -120_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: ac -b - result_expr: - expected_results - -121_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b -ac - result_expr: - expected_results - -122_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b -ac - result_expr: - expected_results - -123_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b -ac - result_expr: - expected_results - -124_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b -ac result_expr: - expected_results - -125_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b -ac result_expr: - expected_results - -126_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b -ac result_expr: - expected_results - -127_n: OK regex: ab\Z parsed_regex: ab\Z str: ca -b - result_expr: - expected_results - -128_n: OK regex: ab\z parsed_regex: ab\z str: ca -b - result_expr: - expected_results - -129_n: OK regex: ab$ parsed_regex: ab$ str: ca -b - result_expr: - expected_results - -130_n: OK regex: ab\Z parsed_regex: ab\Z str: b -ca - result_expr: - expected_results - -131_n: OK regex: ab\z parsed_regex: ab\z str: b -ca - result_expr: - expected_results - -132_n: OK regex: ab$ parsed_regex: ab$ str: b -ca - result_expr: - expected_results - -133_n: OK regex: ab\Z parsed_regex: ab\Z str: b -ca result_expr: - expected_results - -134_n: OK regex: ab\z parsed_regex: ab\z str: b -ca result_expr: - expected_results - -135_n: OK regex: ab$ parsed_regex: ab$ str: b -ca result_expr: - expected_results - -136_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: ca -b - result_expr: - expected_results - -137_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: ca -b - result_expr: - expected_results - -138_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: ca -b - result_expr: - expected_results - -139_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b -ca - result_expr: - expected_results - -140_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b -ca - result_expr: - expected_results - -141_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b -ca - result_expr: - expected_results - -142_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b -ca result_expr: - expected_results - -143_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b -ca result_expr: - expected_results - -144_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b -ca result_expr: - expected_results - -145_n: OK regex: abb\Z parsed_regex: abb\Z str: abb -b - result_expr: - expected_results - -146_n: OK regex: abb\z parsed_regex: abb\z str: abb -b - result_expr: - expected_results - -147_n: OK regex: abb$ parsed_regex: abb$ str: abb -b - result_expr: - expected_results - -148_y: OK regex: abb\Z parsed_regex: abb\Z str: b -abb - result_expr: $-[0] expected_results 2 -149_n: OK regex: abb\z parsed_regex: abb\z str: b -abb - result_expr: - expected_results - -150_y: OK regex: abb$ parsed_regex: abb$ str: b -abb - result_expr: $-[0] expected_results 2 -151_y: OK regex: abb\Z parsed_regex: abb\Z str: b -abb result_expr: $-[0] expected_results 2 -152_y: OK regex: abb\z parsed_regex: abb\z str: b -abb result_expr: $-[0] expected_results 2 -153_y: OK regex: abb$ parsed_regex: abb$ str: b -abb result_expr: $-[0] expected_results 2 -154_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: abb -b - result_expr: - expected_results - -155_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: abb -b - result_expr: - expected_results - -156_y: OK regex: 'abb$'m parsed_regex: 'abb$'m str: abb -b - result_expr: $-[0] expected_results 0 -157_y: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b -abb - result_expr: $-[0] expected_results 2 -158_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b -abb - result_expr: - expected_results - -159_y: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b -abb - result_expr: $-[0] expected_results 2 -160_y: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b -abb result_expr: $-[0] expected_results 2 -161_y: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b -abb result_expr: $-[0] expected_results 2 -162_y: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b -abb result_expr: $-[0] expected_results 2 -163_n: OK regex: abb\Z parsed_regex: abb\Z str: ac -b - result_expr: - expected_results - -164_n: OK regex: abb\z parsed_regex: abb\z str: ac -b - result_expr: - expected_results - -165_n: OK regex: abb$ parsed_regex: abb$ str: ac -b - result_expr: - expected_results - -166_n: OK regex: abb\Z parsed_regex: abb\Z str: b -ac - result_expr: - expected_results - -167_n: OK regex: abb\z parsed_regex: abb\z str: b -ac - result_expr: - expected_results - -168_n: OK regex: abb$ parsed_regex: abb$ str: b -ac - result_expr: - expected_results - -169_n: OK regex: abb\Z parsed_regex: abb\Z str: b -ac result_expr: - expected_results - -170_n: OK regex: abb\z parsed_regex: abb\z str: b -ac result_expr: - expected_results - -171_n: OK regex: abb$ parsed_regex: abb$ str: b -ac result_expr: - expected_results - -172_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: ac -b - result_expr: - expected_results - -173_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: ac -b - result_expr: - expected_results - -174_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: ac -b - result_expr: - expected_results - -175_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b -ac - result_expr: - expected_results - -176_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b -ac - result_expr: - expected_results - -177_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b -ac - result_expr: - expected_results - -178_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b -ac result_expr: - expected_results - -179_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b -ac result_expr: - expected_results - -180_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b -ac result_expr: - expected_results - -181_n: OK regex: abb\Z parsed_regex: abb\Z str: ca -b - result_expr: - expected_results - -182_n: OK regex: abb\z parsed_regex: abb\z str: ca -b - result_expr: - expected_results - -183_n: OK regex: abb$ parsed_regex: abb$ str: ca -b - result_expr: - expected_results - -184_n: OK regex: abb\Z parsed_regex: abb\Z str: b -ca - result_expr: - expected_results - -185_n: OK regex: abb\z parsed_regex: abb\z str: b -ca - result_expr: - expected_results - -186_n: OK regex: abb$ parsed_regex: abb$ str: b -ca - result_expr: - expected_results - -187_n: OK regex: abb\Z parsed_regex: abb\Z str: b -ca result_expr: - expected_results - -188_n: OK regex: abb\z parsed_regex: abb\z str: b -ca result_expr: - expected_results - -189_n: OK regex: abb$ parsed_regex: abb$ str: b -ca result_expr: - expected_results - -190_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: ca -b - result_expr: - expected_results - -191_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: ca -b - result_expr: - expected_results - -192_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: ca -b - result_expr: - expected_results - -193_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b -ca - result_expr: - expected_results - -194_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b -ca - result_expr: - expected_results - -195_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b -ca - result_expr: - expected_results - -196_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b -ca result_expr: - expected_results - -197_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b -ca result_expr: - expected_results - -198_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b -ca result_expr: - expected_results - -199_y: OK regex: '\Aa$'m parsed_regex: '\Aa$'m str: a - - result_expr: $& expected_results a +01_y: OK regex: \Z parsed_regex: \Z str: a\nb\n result_expr: $-[0] expected_results 3 +02_y: OK regex: \z parsed_regex: \z str: a\nb\n result_expr: $-[0] expected_results 4 +03_y: OK regex: $ parsed_regex: $ str: a\nb\n result_expr: $-[0] expected_results 3 +04_y: OK regex: \Z parsed_regex: \Z str: b\na\n result_expr: $-[0] expected_results 3 +05_y: OK regex: \z parsed_regex: \z str: b\na\n result_expr: $-[0] expected_results 4 +06_y: OK regex: $ parsed_regex: $ str: b\na\n result_expr: $-[0] expected_results 3 +07_y: OK regex: \Z parsed_regex: \Z str: b\na result_expr: $-[0] expected_results 3 +08_y: OK regex: \z parsed_regex: \z str: b\na result_expr: $-[0] expected_results 3 +09_y: OK regex: $ parsed_regex: $ str: b\na result_expr: $-[0] expected_results 3 +10_y: OK regex: '\Z'm parsed_regex: '\Z'm str: a\nb\n result_expr: $-[0] expected_results 3 +11_y: OK regex: '\z'm parsed_regex: '\z'm str: a\nb\n result_expr: $-[0] expected_results 4 +12_y: OK regex: '$'m parsed_regex: '$'m str: a\nb\n result_expr: $-[0] expected_results 1 +13_y: OK regex: '\Z'm parsed_regex: '\Z'm str: b\na\n result_expr: $-[0] expected_results 3 +14_y: OK regex: '\z'm parsed_regex: '\z'm str: b\na\n result_expr: $-[0] expected_results 4 +15_y: OK regex: '$'m parsed_regex: '$'m str: b\na\n result_expr: $-[0] expected_results 1 +16_y: OK regex: '\Z'm parsed_regex: '\Z'm str: b\na result_expr: $-[0] expected_results 3 +17_y: OK regex: '\z'm parsed_regex: '\z'm str: b\na result_expr: $-[0] expected_results 3 +18_y: OK regex: '$'m parsed_regex: '$'m str: b\na result_expr: $-[0] expected_results 1 +19_n: OK regex: a\Z parsed_regex: a\Z str: a\nb\n result_expr: - expected_results - +20_n: OK regex: a\z parsed_regex: a\z str: a\nb\n result_expr: - expected_results - +21_n: OK regex: a$ parsed_regex: a$ str: a\nb\n result_expr: - expected_results - +22_y: OK regex: a\Z parsed_regex: a\Z str: b\na\n result_expr: $-[0] expected_results 2 +23_n: OK regex: a\z parsed_regex: a\z str: b\na\n result_expr: - expected_results - +24_y: OK regex: a$ parsed_regex: a$ str: b\na\n result_expr: $-[0] expected_results 2 +25_y: OK regex: a\Z parsed_regex: a\Z str: b\na result_expr: $-[0] expected_results 2 +26_y: OK regex: a\z parsed_regex: a\z str: b\na result_expr: $-[0] expected_results 2 +27_y: OK regex: a$ parsed_regex: a$ str: b\na result_expr: $-[0] expected_results 2 +28_n: OK regex: 'a\Z'm parsed_regex: 'a\Z'm str: a\nb\n result_expr: - expected_results - +29_n: OK regex: 'a\z'm parsed_regex: 'a\z'm str: a\nb\n result_expr: - expected_results - +30_y: OK regex: 'a$'m parsed_regex: 'a$'m str: a\nb\n result_expr: $-[0] expected_results 0 +31_y: OK regex: 'a\Z'm parsed_regex: 'a\Z'm str: b\na\n result_expr: $-[0] expected_results 2 +32_n: OK regex: 'a\z'm parsed_regex: 'a\z'm str: b\na\n result_expr: - expected_results - +33_y: OK regex: 'a$'m parsed_regex: 'a$'m str: b\na\n result_expr: $-[0] expected_results 2 +34_y: OK regex: 'a\Z'm parsed_regex: 'a\Z'm str: b\na result_expr: $-[0] expected_results 2 +35_y: OK regex: 'a\z'm parsed_regex: 'a\z'm str: b\na result_expr: $-[0] expected_results 2 +36_y: OK regex: 'a$'m parsed_regex: 'a$'m str: b\na result_expr: $-[0] expected_results 2 +37_n: OK regex: aa\Z parsed_regex: aa\Z str: aa\nb\n result_expr: - expected_results - +38_n: OK regex: aa\z parsed_regex: aa\z str: aa\nb\n result_expr: - expected_results - +39_n: OK regex: aa$ parsed_regex: aa$ str: aa\nb\n result_expr: - expected_results - +40_y: OK regex: aa\Z parsed_regex: aa\Z str: b\naa\n result_expr: $-[0] expected_results 2 +41_n: OK regex: aa\z parsed_regex: aa\z str: b\naa\n result_expr: - expected_results - +42_y: OK regex: aa$ parsed_regex: aa$ str: b\naa\n result_expr: $-[0] expected_results 2 +43_y: OK regex: aa\Z parsed_regex: aa\Z str: b\naa result_expr: $-[0] expected_results 2 +44_y: OK regex: aa\z parsed_regex: aa\z str: b\naa result_expr: $-[0] expected_results 2 +45_y: OK regex: aa$ parsed_regex: aa$ str: b\naa result_expr: $-[0] expected_results 2 +46_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: aa\nb\n result_expr: - expected_results - +47_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: aa\nb\n result_expr: - expected_results - +48_y: OK regex: 'aa$'m parsed_regex: 'aa$'m str: aa\nb\n result_expr: $-[0] expected_results 0 +49_y: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b\naa\n result_expr: $-[0] expected_results 2 +50_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b\naa\n result_expr: - expected_results - +51_y: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b\naa\n result_expr: $-[0] expected_results 2 +52_y: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b\naa result_expr: $-[0] expected_results 2 +53_y: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b\naa result_expr: $-[0] expected_results 2 +54_y: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b\naa result_expr: $-[0] expected_results 2 +55_n: OK regex: aa\Z parsed_regex: aa\Z str: ac\nb\n result_expr: - expected_results - +56_n: OK regex: aa\z parsed_regex: aa\z str: ac\nb\n result_expr: - expected_results - +57_n: OK regex: aa$ parsed_regex: aa$ str: ac\nb\n result_expr: - expected_results - +58_n: OK regex: aa\Z parsed_regex: aa\Z str: b\nac\n result_expr: - expected_results - +59_n: OK regex: aa\z parsed_regex: aa\z str: b\nac\n result_expr: - expected_results - +60_n: OK regex: aa$ parsed_regex: aa$ str: b\nac\n result_expr: - expected_results - +61_n: OK regex: aa\Z parsed_regex: aa\Z str: b\nac result_expr: - expected_results - +62_n: OK regex: aa\z parsed_regex: aa\z str: b\nac result_expr: - expected_results - +63_n: OK regex: aa$ parsed_regex: aa$ str: b\nac result_expr: - expected_results - +64_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: ac\nb\n result_expr: - expected_results - +65_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: ac\nb\n result_expr: - expected_results - +66_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: ac\nb\n result_expr: - expected_results - +67_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b\nac\n result_expr: - expected_results - +68_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b\nac\n result_expr: - expected_results - +69_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b\nac\n result_expr: - expected_results - +70_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b\nac result_expr: - expected_results - +71_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b\nac result_expr: - expected_results - +72_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b\nac result_expr: - expected_results - +73_n: OK regex: aa\Z parsed_regex: aa\Z str: ca\nb\n result_expr: - expected_results - +74_n: OK regex: aa\z parsed_regex: aa\z str: ca\nb\n result_expr: - expected_results - +75_n: OK regex: aa$ parsed_regex: aa$ str: ca\nb\n result_expr: - expected_results - +76_n: OK regex: aa\Z parsed_regex: aa\Z str: b\nca\n result_expr: - expected_results - +77_n: OK regex: aa\z parsed_regex: aa\z str: b\nca\n result_expr: - expected_results - +78_n: OK regex: aa$ parsed_regex: aa$ str: b\nca\n result_expr: - expected_results - +79_n: OK regex: aa\Z parsed_regex: aa\Z str: b\nca result_expr: - expected_results - +80_n: OK regex: aa\z parsed_regex: aa\z str: b\nca result_expr: - expected_results - +81_n: OK regex: aa$ parsed_regex: aa$ str: b\nca result_expr: - expected_results - +82_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: ca\nb\n result_expr: - expected_results - +83_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: ca\nb\n result_expr: - expected_results - +84_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: ca\nb\n result_expr: - expected_results - +85_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b\nca\n result_expr: - expected_results - +86_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b\nca\n result_expr: - expected_results - +87_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b\nca\n result_expr: - expected_results - +88_n: OK regex: 'aa\Z'm parsed_regex: 'aa\Z'm str: b\nca result_expr: - expected_results - +89_n: OK regex: 'aa\z'm parsed_regex: 'aa\z'm str: b\nca result_expr: - expected_results - +90_n: OK regex: 'aa$'m parsed_regex: 'aa$'m str: b\nca result_expr: - expected_results - +91_n: OK regex: ab\Z parsed_regex: ab\Z str: ab\nb\n result_expr: - expected_results - +92_n: OK regex: ab\z parsed_regex: ab\z str: ab\nb\n result_expr: - expected_results - +93_n: OK regex: ab$ parsed_regex: ab$ str: ab\nb\n result_expr: - expected_results - +94_y: OK regex: ab\Z parsed_regex: ab\Z str: b\nab\n result_expr: $-[0] expected_results 2 +95_n: OK regex: ab\z parsed_regex: ab\z str: b\nab\n result_expr: - expected_results - +96_y: OK regex: ab$ parsed_regex: ab$ str: b\nab\n result_expr: $-[0] expected_results 2 +97_y: OK regex: ab\Z parsed_regex: ab\Z str: b\nab result_expr: $-[0] expected_results 2 +98_y: OK regex: ab\z parsed_regex: ab\z str: b\nab result_expr: $-[0] expected_results 2 +99_y: OK regex: ab$ parsed_regex: ab$ str: b\nab result_expr: $-[0] expected_results 2 +100_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: ab\nb\n result_expr: - expected_results - +101_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: ab\nb\n result_expr: - expected_results - +102_y: OK regex: 'ab$'m parsed_regex: 'ab$'m str: ab\nb\n result_expr: $-[0] expected_results 0 +103_y: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b\nab\n result_expr: $-[0] expected_results 2 +104_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b\nab\n result_expr: - expected_results - +105_y: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b\nab\n result_expr: $-[0] expected_results 2 +106_y: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b\nab result_expr: $-[0] expected_results 2 +107_y: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b\nab result_expr: $-[0] expected_results 2 +108_y: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b\nab result_expr: $-[0] expected_results 2 +109_n: OK regex: ab\Z parsed_regex: ab\Z str: ac\nb\n result_expr: - expected_results - +110_n: OK regex: ab\z parsed_regex: ab\z str: ac\nb\n result_expr: - expected_results - +111_n: OK regex: ab$ parsed_regex: ab$ str: ac\nb\n result_expr: - expected_results - +112_n: OK regex: ab\Z parsed_regex: ab\Z str: b\nac\n result_expr: - expected_results - +113_n: OK regex: ab\z parsed_regex: ab\z str: b\nac\n result_expr: - expected_results - +114_n: OK regex: ab$ parsed_regex: ab$ str: b\nac\n result_expr: - expected_results - +115_n: OK regex: ab\Z parsed_regex: ab\Z str: b\nac result_expr: - expected_results - +116_n: OK regex: ab\z parsed_regex: ab\z str: b\nac result_expr: - expected_results - +117_n: OK regex: ab$ parsed_regex: ab$ str: b\nac result_expr: - expected_results - +118_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: ac\nb\n result_expr: - expected_results - +119_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: ac\nb\n result_expr: - expected_results - +120_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: ac\nb\n result_expr: - expected_results - +121_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b\nac\n result_expr: - expected_results - +122_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b\nac\n result_expr: - expected_results - +123_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b\nac\n result_expr: - expected_results - +124_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b\nac result_expr: - expected_results - +125_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b\nac result_expr: - expected_results - +126_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b\nac result_expr: - expected_results - +127_n: OK regex: ab\Z parsed_regex: ab\Z str: ca\nb\n result_expr: - expected_results - +128_n: OK regex: ab\z parsed_regex: ab\z str: ca\nb\n result_expr: - expected_results - +129_n: OK regex: ab$ parsed_regex: ab$ str: ca\nb\n result_expr: - expected_results - +130_n: OK regex: ab\Z parsed_regex: ab\Z str: b\nca\n result_expr: - expected_results - +131_n: OK regex: ab\z parsed_regex: ab\z str: b\nca\n result_expr: - expected_results - +132_n: OK regex: ab$ parsed_regex: ab$ str: b\nca\n result_expr: - expected_results - +133_n: OK regex: ab\Z parsed_regex: ab\Z str: b\nca result_expr: - expected_results - +134_n: OK regex: ab\z parsed_regex: ab\z str: b\nca result_expr: - expected_results - +135_n: OK regex: ab$ parsed_regex: ab$ str: b\nca result_expr: - expected_results - +136_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: ca\nb\n result_expr: - expected_results - +137_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: ca\nb\n result_expr: - expected_results - +138_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: ca\nb\n result_expr: - expected_results - +139_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b\nca\n result_expr: - expected_results - +140_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b\nca\n result_expr: - expected_results - +141_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b\nca\n result_expr: - expected_results - +142_n: OK regex: 'ab\Z'm parsed_regex: 'ab\Z'm str: b\nca result_expr: - expected_results - +143_n: OK regex: 'ab\z'm parsed_regex: 'ab\z'm str: b\nca result_expr: - expected_results - +144_n: OK regex: 'ab$'m parsed_regex: 'ab$'m str: b\nca result_expr: - expected_results - +145_n: OK regex: abb\Z parsed_regex: abb\Z str: abb\nb\n result_expr: - expected_results - +146_n: OK regex: abb\z parsed_regex: abb\z str: abb\nb\n result_expr: - expected_results - +147_n: OK regex: abb$ parsed_regex: abb$ str: abb\nb\n result_expr: - expected_results - +148_y: OK regex: abb\Z parsed_regex: abb\Z str: b\nabb\n result_expr: $-[0] expected_results 2 +149_n: OK regex: abb\z parsed_regex: abb\z str: b\nabb\n result_expr: - expected_results - +150_y: OK regex: abb$ parsed_regex: abb$ str: b\nabb\n result_expr: $-[0] expected_results 2 +151_y: OK regex: abb\Z parsed_regex: abb\Z str: b\nabb result_expr: $-[0] expected_results 2 +152_y: OK regex: abb\z parsed_regex: abb\z str: b\nabb result_expr: $-[0] expected_results 2 +153_y: OK regex: abb$ parsed_regex: abb$ str: b\nabb result_expr: $-[0] expected_results 2 +154_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: abb\nb\n result_expr: - expected_results - +155_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: abb\nb\n result_expr: - expected_results - +156_y: OK regex: 'abb$'m parsed_regex: 'abb$'m str: abb\nb\n result_expr: $-[0] expected_results 0 +157_y: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b\nabb\n result_expr: $-[0] expected_results 2 +158_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b\nabb\n result_expr: - expected_results - +159_y: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b\nabb\n result_expr: $-[0] expected_results 2 +160_y: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b\nabb result_expr: $-[0] expected_results 2 +161_y: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b\nabb result_expr: $-[0] expected_results 2 +162_y: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b\nabb result_expr: $-[0] expected_results 2 +163_n: OK regex: abb\Z parsed_regex: abb\Z str: ac\nb\n result_expr: - expected_results - +164_n: OK regex: abb\z parsed_regex: abb\z str: ac\nb\n result_expr: - expected_results - +165_n: OK regex: abb$ parsed_regex: abb$ str: ac\nb\n result_expr: - expected_results - +166_n: OK regex: abb\Z parsed_regex: abb\Z str: b\nac\n result_expr: - expected_results - +167_n: OK regex: abb\z parsed_regex: abb\z str: b\nac\n result_expr: - expected_results - +168_n: OK regex: abb$ parsed_regex: abb$ str: b\nac\n result_expr: - expected_results - +169_n: OK regex: abb\Z parsed_regex: abb\Z str: b\nac result_expr: - expected_results - +170_n: OK regex: abb\z parsed_regex: abb\z str: b\nac result_expr: - expected_results - +171_n: OK regex: abb$ parsed_regex: abb$ str: b\nac result_expr: - expected_results - +172_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: ac\nb\n result_expr: - expected_results - +173_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: ac\nb\n result_expr: - expected_results - +174_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: ac\nb\n result_expr: - expected_results - +175_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b\nac\n result_expr: - expected_results - +176_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b\nac\n result_expr: - expected_results - +177_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b\nac\n result_expr: - expected_results - +178_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b\nac result_expr: - expected_results - +179_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b\nac result_expr: - expected_results - +180_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b\nac result_expr: - expected_results - +181_n: OK regex: abb\Z parsed_regex: abb\Z str: ca\nb\n result_expr: - expected_results - +182_n: OK regex: abb\z parsed_regex: abb\z str: ca\nb\n result_expr: - expected_results - +183_n: OK regex: abb$ parsed_regex: abb$ str: ca\nb\n result_expr: - expected_results - +184_n: OK regex: abb\Z parsed_regex: abb\Z str: b\nca\n result_expr: - expected_results - +185_n: OK regex: abb\z parsed_regex: abb\z str: b\nca\n result_expr: - expected_results - +186_n: OK regex: abb$ parsed_regex: abb$ str: b\nca\n result_expr: - expected_results - +187_n: OK regex: abb\Z parsed_regex: abb\Z str: b\nca result_expr: - expected_results - +188_n: OK regex: abb\z parsed_regex: abb\z str: b\nca result_expr: - expected_results - +189_n: OK regex: abb$ parsed_regex: abb$ str: b\nca result_expr: - expected_results - +190_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: ca\nb\n result_expr: - expected_results - +191_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: ca\nb\n result_expr: - expected_results - +192_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: ca\nb\n result_expr: - expected_results - +193_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b\nca\n result_expr: - expected_results - +194_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b\nca\n result_expr: - expected_results - +195_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b\nca\n result_expr: - expected_results - +196_n: OK regex: 'abb\Z'm parsed_regex: 'abb\Z'm str: b\nca result_expr: - expected_results - +197_n: OK regex: 'abb\z'm parsed_regex: 'abb\z'm str: b\nca result_expr: - expected_results - +198_n: OK regex: 'abb$'m parsed_regex: 'abb$'m str: b\nca result_expr: - expected_results - +199_y: OK regex: '\Aa$'m parsed_regex: '\Aa$'m str: a\n\n result_expr: $& expected_results a diff --git a/regression-tests/test-results/gcc-13-c++2b/pure2-regex_15_group_modifiers.cpp.execution b/regression-tests/test-results/gcc-13-c++2b/pure2-regex_15_group_modifiers.cpp.execution index de92abc48..825910cc8 100644 --- a/regression-tests/test-results/gcc-13-c++2b/pure2-regex_15_group_modifiers.cpp.execution +++ b/regression-tests/test-results/gcc-13-c++2b/pure2-regex_15_group_modifiers.cpp.execution @@ -31,56 +31,24 @@ Running tests_15_group_modifiers: 30_y: OK regex: '((?-i:a))b'i parsed_regex: '((?-i:a))b'i str: aB result_expr: $1 expected_results a 31_n: OK regex: '(?-i:a)b'i parsed_regex: '(?-i:a)b'i str: AB result_expr: - expected_results - 32_n: OK regex: '((?-i:a))b'i parsed_regex: '((?-i:a))b'i str: AB result_expr: - expected_results - -33_n: OK regex: '((?-i:a.))b'i parsed_regex: '((?-i:a.))b'i str: a -B result_expr: - expected_results - -34_n: OK regex: '((?-i:a\N))b'i parsed_regex: '((?-i:a\N))b'i str: a -B result_expr: - expected_results - -35_y: OK regex: '((?s-i:a.))b'i parsed_regex: '((?s-i:a.))b'i str: a -B result_expr: $1 expected_results a - -36_n: OK regex: '((?s-i:a\N))b'i parsed_regex: '((?s-i:a\N))b'i str: a -B result_expr: - expected_results - -37_n: OK regex: '((?s-i:a.))b'i parsed_regex: '((?s-i:a.))b'i str: B -B result_expr: - expected_results - -38_n: OK regex: '((?s-i:a\N))b'i parsed_regex: '((?s-i:a\N))b'i str: B -B result_expr: - expected_results - +33_n: OK regex: '((?-i:a.))b'i parsed_regex: '((?-i:a.))b'i str: a\nB result_expr: - expected_results - +34_n: OK regex: '((?-i:a\N))b'i parsed_regex: '((?-i:a\N))b'i str: a\nB result_expr: - expected_results - +35_y: OK regex: '((?s-i:a.))b'i parsed_regex: '((?s-i:a.))b'i str: a\nB result_expr: $1 expected_results a\n +36_n: OK regex: '((?s-i:a\N))b'i parsed_regex: '((?s-i:a\N))b'i str: a\nB result_expr: - expected_results - +37_n: OK regex: '((?s-i:a.))b'i parsed_regex: '((?s-i:a.))b'i str: B\nB result_expr: - expected_results - +38_n: OK regex: '((?s-i:a\N))b'i parsed_regex: '((?s-i:a\N))b'i str: B\nB result_expr: - expected_results - 39_y: OK regex: (?i:.[b].) parsed_regex: (?i:.[b].) str: abd result_expr: $& expected_results abd 40_y: OK regex: (?i:\N[b]\N) parsed_regex: (?i:\N[b]\N) str: abd result_expr: $& expected_results abd 41_n: OK regex: ^(?:a?b?)*$ parsed_regex: ^(?:a?b?)*$ str: a-- result_expr: - expected_results - -42_y: OK regex: ((?s)^a(.))((?m)^b$) parsed_regex: ((?s)^a(.))((?m)^b$) str: a -b -c - result_expr: $1;$2;$3 expected_results a -; -;b -43_y: OK regex: ((?m)^b$) parsed_regex: ((?m)^b$) str: a -b -c - result_expr: $1 expected_results b -44_y: OK regex: (?m)^b parsed_regex: (?m)^b str: a -b - result_expr: $& expected_results b -45_y: OK regex: (?m)^(b) parsed_regex: (?m)^(b) str: a -b - result_expr: $1 expected_results b -46_y: OK regex: ((?m)^b) parsed_regex: ((?m)^b) str: a -b - result_expr: $1 expected_results b -47_y: OK regex: \n((?m)^b) parsed_regex: \n((?m)^b) str: a -b - result_expr: $1 expected_results b -48_n: OK regex: ^b parsed_regex: ^b str: a -b -c - result_expr: - expected_results - -49_n: OK regex: ()^b parsed_regex: ()^b str: a -b -c - result_expr: - expected_results - -50_y: OK regex: ((?m)^b) parsed_regex: ((?m)^b) str: a -b -c - result_expr: $1 expected_results b +42_y: OK regex: ((?s)^a(.))((?m)^b$) parsed_regex: ((?s)^a(.))((?m)^b$) str: a\nb\nc\n result_expr: $1;$2;$3 expected_results a\n;\n;b +43_y: OK regex: ((?m)^b$) parsed_regex: ((?m)^b$) str: a\nb\nc\n result_expr: $1 expected_results b +44_y: OK regex: (?m)^b parsed_regex: (?m)^b str: a\nb\n result_expr: $& expected_results b +45_y: OK regex: (?m)^(b) parsed_regex: (?m)^(b) str: a\nb\n result_expr: $1 expected_results b +46_y: OK regex: ((?m)^b) parsed_regex: ((?m)^b) str: a\nb\n result_expr: $1 expected_results b +47_y: OK regex: \n((?m)^b) parsed_regex: \n((?m)^b) str: a\nb\n result_expr: $1 expected_results b +48_n: OK regex: ^b parsed_regex: ^b str: a\nb\nc\n result_expr: - expected_results - +49_n: OK regex: ()^b parsed_regex: ()^b str: a\nb\nc\n result_expr: - expected_results - +50_y: OK regex: ((?m)^b) parsed_regex: ((?m)^b) str: a\nb\nc\n result_expr: $1 expected_results b 51_y: OK Warning: Parsed regex does not match. regex: '(foo)'n parsed_regex: '(?:foo)'n str: foobar result_expr: $&-$1 expected_results foo- 52_y: OK Warning: Parsed regex does not match. regex: '(?-n)(foo)(?n)(bar)'n parsed_regex: '(?-n)(foo)(?n)(?:bar)'n str: foobar result_expr: $&-$1-$2 expected_results foobar-foo- 53_y: OK Warning: Parsed regex does not match. regex: '(?-n:(foo)(?n:(bar)))'n parsed_regex: '(?-n:(foo)(?n:(?:bar)))'n str: foobar result_expr: $&-$1-$2 expected_results foobar-foo- diff --git a/regression-tests/test-results/gcc-13-c++2b/pure2-regex_19_lookahead.cpp.execution b/regression-tests/test-results/gcc-13-c++2b/pure2-regex_19_lookahead.cpp.execution index 7b34914b1..d4c65d951 100644 --- a/regression-tests/test-results/gcc-13-c++2b/pure2-regex_19_lookahead.cpp.execution +++ b/regression-tests/test-results/gcc-13-c++2b/pure2-regex_19_lookahead.cpp.execution @@ -29,9 +29,7 @@ Running tests_19_lookahead: 28_y: OK regex: a(?!b(?=a))(..) parsed_regex: a(?!b(?=a))(..) str: abababc result_expr: $1 expected_results bc 37_y: OK regex: X(\w+)(?=\s)|X(\w+) parsed_regex: X(\w+)(?=\s)|X(\w+) str: Xab result_expr: [$1-$2] expected_results [-ab] 38_y: OK regex: ^a*(?=b)b parsed_regex: ^a*(?=b)b str: ab result_expr: $& expected_results ab -39_y: OK regex: '(?!\A)x'm parsed_regex: '(?!\A)x'm str: a -xb - result_expr: - expected_results - +39_y: OK regex: '(?!\A)x'm parsed_regex: '(?!\A)x'm str: a\nxb\n result_expr: - expected_results - 40_n: OK regex: '^(o)(?!.*\1)'i parsed_regex: '^(o)(?!.*\1)'i str: Oo result_expr: - expected_results - 41_n: OK regex: .*a(?!(b|cd)*e).*f parsed_regex: .*a(?!(b|cd)*e).*f str: ......abef result_expr: - expected_results - 42_y: OK regex: ^(a*?)(?!(aa|aaaa)*$) parsed_regex: ^(a*?)(?!(aa|aaaa)*$) str: aaaaaaaaaaaaaaaaaaaa result_expr: $1 expected_results a @@ -39,39 +37,11 @@ xb 44_y: OK regex: ^(a*?)(?!(a{6}|a{5})*$) parsed_regex: ^(a*?)(?!(a{6}|a{5})*$) str: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa result_expr: $+[1] expected_results 12 45_y: OK regex: a(?!b(?!c(?!d(?!e))))...(.) parsed_regex: a(?!b(?!c(?!d(?!e))))...(.) str: abxabcdxabcde result_expr: $1 expected_results e 46_y: OK regex: X(?!b+(?!(c+)*(?!(c+)*d))).*X parsed_regex: X(?!b+(?!(c+)*(?!(c+)*d))).*X str: aXbbbbbbbcccccccccccccaaaX result_expr: - expected_results - -47_y: OK regex: ((?s).)c(?!.) parsed_regex: ((?s).)c(?!.) str: a -b -c - result_expr: $1 expected_results - -48_y: OK regex: ((?s).)c(?!.) parsed_regex: ((?s).)c(?!.) str: a -b -c - result_expr: $1:$& expected_results -: -c -49_y: OK regex: ((?s)b.)c(?!.) parsed_regex: ((?s)b.)c(?!.) str: a -b -c - result_expr: $1 expected_results b - -50_y: OK regex: ((?s)b.)c(?!.) parsed_regex: ((?s)b.)c(?!.) str: a -b -c - result_expr: $1:$& expected_results b -:b -c -51_y: OK regex: ((?s)b.)c(?!\N) parsed_regex: ((?s)b.)c(?!\N) str: a -b -c - result_expr: $1:$& expected_results b -:b -c -52_y: OK regex: '(b.)c(?!\N)'s parsed_regex: '(b.)c(?!\N)'s str: a -b -c - result_expr: $1:$& expected_results b -:b -c +47_y: OK regex: ((?s).)c(?!.) parsed_regex: ((?s).)c(?!.) str: a\nb\nc\n result_expr: $1 expected_results \n +48_y: OK regex: ((?s).)c(?!.) parsed_regex: ((?s).)c(?!.) str: a\nb\nc\n result_expr: $1:$& expected_results \n:\nc +49_y: OK regex: ((?s)b.)c(?!.) parsed_regex: ((?s)b.)c(?!.) str: a\nb\nc\n result_expr: $1 expected_results b\n +50_y: OK regex: ((?s)b.)c(?!.) parsed_regex: ((?s)b.)c(?!.) str: a\nb\nc\n result_expr: $1:$& expected_results b\n:b\nc +51_y: OK regex: ((?s)b.)c(?!\N) parsed_regex: ((?s)b.)c(?!\N) str: a\nb\nc\n result_expr: $1:$& expected_results b\n:b\nc +52_y: OK regex: '(b.)c(?!\N)'s parsed_regex: '(b.)c(?!\N)'s str: a\nb\nc\n result_expr: $1:$& expected_results b\n:b\nc 53_n: OK regex: a*(?!) parsed_regex: a*(?!) str: aaaab result_expr: - expected_results - diff --git a/regression-tests/test-results/msvc-2022-c++latest/pure2-regex_10_escapes.cpp.execution b/regression-tests/test-results/msvc-2022-c++latest/pure2-regex_10_escapes.cpp.execution index 14d06c270..fe6e6efc9 100644 --- a/regression-tests/test-results/msvc-2022-c++latest/pure2-regex_10_escapes.cpp.execution +++ b/regression-tests/test-results/msvc-2022-c++latest/pure2-regex_10_escapes.cpp.execution @@ -9,26 +9,26 @@ Running tests_10_escapes: 08_y: OK regex: foo(\h)bar parsed_regex: foo(\h)bar str: foo bar result_expr: $1 expected_results 09_y: OK regex: (\H)(\h) parsed_regex: (\H)(\h) str: foo bar result_expr: $1-$2 expected_results o- 10_y: OK regex: (\h)(\H) parsed_regex: (\h)(\H) str: foo bar result_expr: $1-$2 expected_results -b -11_y: OK regex: foo(\v+)bar parsed_regex: foo(\v+)bar str: foo - +11_y: OK regex: foo(\v+)bar parsed_regex: foo(\v+)bar str: foo -bar result_expr: $1 expected_results - +bar result_expr: $1 expected_results -12_y: OK regex: (\V+)(\v) parsed_regex: (\V+)(\v) str: foo - -bar result_expr: $1-$2 expected_results foo- -13_y: OK regex: (\v+)(\V) parsed_regex: (\v+)(\V) str: foo - -bar result_expr: $1-$2 expected_results - +12_y: OK regex: (\V+)(\v) parsed_regex: (\V+)(\v) str: foo + + +bar result_expr: $1-$2 expected_results foo- +13_y: OK regex: (\v+)(\V) parsed_regex: (\v+)(\V) str: foo + + +bar result_expr: $1-$2 expected_results + -b -14_y: OK regex: foo(\v)bar parsed_regex: foo(\v)bar str: foo bar result_expr: $1 expected_results -15_y: OK regex: (\V)(\v) parsed_regex: (\V)(\v) str: foo bar result_expr: $1-$2 expected_results o- +14_y: OK regex: foo(\v)bar parsed_regex: foo(\v)bar str: foo bar result_expr: $1 expected_results +15_y: OK regex: (\V)(\v) parsed_regex: (\V)(\v) str: foo bar result_expr: $1-$2 expected_results o- 16_y: OK regex: (\v)(\V) parsed_regex: (\v)(\V) str: foo bar result_expr: $1-$2 expected_results -b 17_y: OK regex: foo\t\n\r\f\a\ebar parsed_regex: foo\t\n\r\f\a\ebar str: foo bar result_expr: $& expected_results foo diff --git a/regression-tests/test-results/pure2-regex_01_char_matcher.cpp b/regression-tests/test-results/pure2-regex_01_char_matcher.cpp index 13500736b..05c6300d1 100644 --- a/regression-tests/test-results/pure2-regex_01_char_matcher.cpp +++ b/regression-tests/test-results/pure2-regex_01_char_matcher.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_01_char_matcher.cpp2" -#line 153 "pure2-regex_01_char_matcher.cpp2" +#line 165 "pure2-regex_01_char_matcher.cpp2" class test_tests_01_char_matcher; @@ -19,13 +19,16 @@ class test_tests_01_char_matcher; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_01_char_matcher.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_01_char_matcher.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_01_char_matcher.cpp2" +#line 165 "pure2-regex_01_char_matcher.cpp2" class test_tests_01_char_matcher { -#line 166 "pure2-regex_01_char_matcher.cpp2" +#line 178 "pure2-regex_01_char_matcher.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -345,7 +348,7 @@ public: class func_0 { public: auto operator=(test_tests_01_char_matcher const&) -> void = delete; -#line 182 "pure2-regex_01_char_matcher.cpp2" +#line 194 "pure2-regex_01_char_matcher.cpp2" }; auto main() -> int; @@ -465,6 +468,19 @@ auto main() -> int; } #line 112 "pure2-regex_01_char_matcher.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_01_char_matcher.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -487,7 +503,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -502,10 +518,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 166 "pure2-regex_01_char_matcher.cpp2" +#line 178 "pure2-regex_01_char_matcher.cpp2" auto test_tests_01_char_matcher::run() const& -> void{ std::cout << "Running tests_01_char_matcher:" << std::endl; test(regex_01, "01", R"(abc)", "abc", "y", R"($&)", "abc"); @@ -1135,7 +1151,7 @@ int i{0}; [[nodiscard]] auto test_tests_01_char_matcher::regex_12_matcher::to_string() -> std::string{return R"(abc)"; } -#line 183 "pure2-regex_01_char_matcher.cpp2" +#line 195 "pure2-regex_01_char_matcher.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_01_char_matcher()); } diff --git a/regression-tests/test-results/pure2-regex_02_ranges.cpp b/regression-tests/test-results/pure2-regex_02_ranges.cpp index 0524a5328..f0dccd16d 100644 --- a/regression-tests/test-results/pure2-regex_02_ranges.cpp +++ b/regression-tests/test-results/pure2-regex_02_ranges.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_02_ranges.cpp2" -#line 153 "pure2-regex_02_ranges.cpp2" +#line 165 "pure2-regex_02_ranges.cpp2" class test_tests_02_ranges; @@ -19,13 +19,16 @@ class test_tests_02_ranges; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_02_ranges.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_02_ranges.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_02_ranges.cpp2" +#line 165 "pure2-regex_02_ranges.cpp2" class test_tests_02_ranges { -#line 194 "pure2-regex_02_ranges.cpp2" +#line 206 "pure2-regex_02_ranges.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -1473,7 +1476,7 @@ public: class func_1 { public: auto operator=(test_tests_02_ranges const&) -> void = delete; -#line 238 "pure2-regex_02_ranges.cpp2" +#line 250 "pure2-regex_02_ranges.cpp2" }; auto main() -> int; @@ -1593,6 +1596,19 @@ auto main() -> int; } #line 112 "pure2-regex_02_ranges.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_02_ranges.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -1615,7 +1631,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -1630,10 +1646,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 194 "pure2-regex_02_ranges.cpp2" +#line 206 "pure2-regex_02_ranges.cpp2" auto test_tests_02_ranges::run() const& -> void{ std::cout << "Running tests_02_ranges:" << std::endl; test(regex_01, "01", R"(ab*c)", "abc", "y", R"($&)", "abc"); @@ -6279,7 +6295,7 @@ int i{0}; [[nodiscard]] auto test_tests_02_ranges::regex_40_matcher::to_string() -> std::string{return R"(ab{0,1}c)"; } -#line 239 "pure2-regex_02_ranges.cpp2" +#line 251 "pure2-regex_02_ranges.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_02_ranges()); } diff --git a/regression-tests/test-results/pure2-regex_03_wildcard.cpp b/regression-tests/test-results/pure2-regex_03_wildcard.cpp index 18522d9fd..10ffe1c3b 100644 --- a/regression-tests/test-results/pure2-regex_03_wildcard.cpp +++ b/regression-tests/test-results/pure2-regex_03_wildcard.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_03_wildcard.cpp2" -#line 153 "pure2-regex_03_wildcard.cpp2" +#line 165 "pure2-regex_03_wildcard.cpp2" class test_tests_03_wildcard; @@ -19,13 +19,16 @@ class test_tests_03_wildcard; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_03_wildcard.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_03_wildcard.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_03_wildcard.cpp2" +#line 165 "pure2-regex_03_wildcard.cpp2" class test_tests_03_wildcard { -#line 174 "pure2-regex_03_wildcard.cpp2" +#line 186 "pure2-regex_03_wildcard.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -723,7 +726,7 @@ public: class func_1 { public: auto operator=(test_tests_03_wildcard const&) -> void = delete; -#line 198 "pure2-regex_03_wildcard.cpp2" +#line 210 "pure2-regex_03_wildcard.cpp2" }; auto main() -> int; @@ -843,6 +846,19 @@ auto main() -> int; } #line 112 "pure2-regex_03_wildcard.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_03_wildcard.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -865,7 +881,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -880,10 +896,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 174 "pure2-regex_03_wildcard.cpp2" +#line 186 "pure2-regex_03_wildcard.cpp2" auto test_tests_03_wildcard::run() const& -> void{ std::cout << "Running tests_03_wildcard:" << std::endl; test(regex_01, "01", R"(.{1})", "abbbbc", "y", R"($&)", "a"); @@ -2477,7 +2493,7 @@ int i{0}; [[nodiscard]] auto test_tests_03_wildcard::regex_20_matcher::to_string() -> std::string{return R"(a\N*c)"; } -#line 199 "pure2-regex_03_wildcard.cpp2" +#line 211 "pure2-regex_03_wildcard.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_03_wildcard()); } diff --git a/regression-tests/test-results/pure2-regex_04_start_end.cpp b/regression-tests/test-results/pure2-regex_04_start_end.cpp index 0e857b7e5..e703460ea 100644 --- a/regression-tests/test-results/pure2-regex_04_start_end.cpp +++ b/regression-tests/test-results/pure2-regex_04_start_end.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_04_start_end.cpp2" -#line 153 "pure2-regex_04_start_end.cpp2" +#line 165 "pure2-regex_04_start_end.cpp2" class test_tests_04_start_end; @@ -19,13 +19,16 @@ class test_tests_04_start_end; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_04_start_end.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_04_start_end.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_04_start_end.cpp2" +#line 165 "pure2-regex_04_start_end.cpp2" class test_tests_04_start_end { -#line 163 "pure2-regex_04_start_end.cpp2" +#line 175 "pure2-regex_04_start_end.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -267,7 +270,7 @@ public: class func_0 { public: auto operator=(test_tests_04_start_end const&) -> void = delete; -#line 176 "pure2-regex_04_start_end.cpp2" +#line 188 "pure2-regex_04_start_end.cpp2" }; auto main() -> int; @@ -387,6 +390,19 @@ auto main() -> int; } #line 112 "pure2-regex_04_start_end.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_04_start_end.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -409,7 +425,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -424,10 +440,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 163 "pure2-regex_04_start_end.cpp2" +#line 175 "pure2-regex_04_start_end.cpp2" auto test_tests_04_start_end::run() const& -> void{ std::cout << "Running tests_04_start_end:" << std::endl; test(regex_01, "01", R"(^abc$)", "abc", "y", R"($&)", "abc"); @@ -885,7 +901,7 @@ int i{0}; [[nodiscard]] auto test_tests_04_start_end::regex_09_matcher::to_string() -> std::string{return R"($b)"; } -#line 177 "pure2-regex_04_start_end.cpp2" +#line 189 "pure2-regex_04_start_end.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_04_start_end()); } diff --git a/regression-tests/test-results/pure2-regex_05_classes.cpp b/regression-tests/test-results/pure2-regex_05_classes.cpp index 7b569df9f..9918773cf 100644 --- a/regression-tests/test-results/pure2-regex_05_classes.cpp +++ b/regression-tests/test-results/pure2-regex_05_classes.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_05_classes.cpp2" -#line 153 "pure2-regex_05_classes.cpp2" +#line 165 "pure2-regex_05_classes.cpp2" class test_tests_05_classes; @@ -19,13 +19,16 @@ class test_tests_05_classes; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_05_classes.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_05_classes.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_05_classes.cpp2" +#line 165 "pure2-regex_05_classes.cpp2" class test_tests_05_classes { -#line 173 "pure2-regex_05_classes.cpp2" +#line 185 "pure2-regex_05_classes.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -527,7 +530,7 @@ public: class func_0 { public: auto operator=(test_tests_05_classes const&) -> void = delete; -#line 196 "pure2-regex_05_classes.cpp2" +#line 208 "pure2-regex_05_classes.cpp2" }; auto main() -> int; @@ -647,6 +650,19 @@ auto main() -> int; } #line 112 "pure2-regex_05_classes.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_05_classes.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -669,7 +685,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -684,10 +700,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 173 "pure2-regex_05_classes.cpp2" +#line 185 "pure2-regex_05_classes.cpp2" auto test_tests_05_classes::run() const& -> void{ std::cout << "Running tests_05_classes:" << std::endl; test(regex_01, "01", R"(a[bc]d)", "abc", "n", R"(-)", "-"); @@ -1831,7 +1847,7 @@ int i{0}; [[nodiscard]] auto test_tests_05_classes::regex_19_matcher::to_string() -> std::string{return R"(a[^]b]c)"; } -#line 197 "pure2-regex_05_classes.cpp2" +#line 209 "pure2-regex_05_classes.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_05_classes()); } diff --git a/regression-tests/test-results/pure2-regex_06_boundaries.cpp b/regression-tests/test-results/pure2-regex_06_boundaries.cpp index bbca6c3ec..5d863f145 100644 --- a/regression-tests/test-results/pure2-regex_06_boundaries.cpp +++ b/regression-tests/test-results/pure2-regex_06_boundaries.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_06_boundaries.cpp2" -#line 153 "pure2-regex_06_boundaries.cpp2" +#line 165 "pure2-regex_06_boundaries.cpp2" class test_tests_06_boundaries; @@ -19,13 +19,16 @@ class test_tests_06_boundaries; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_06_boundaries.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_06_boundaries.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_06_boundaries.cpp2" +#line 165 "pure2-regex_06_boundaries.cpp2" class test_tests_06_boundaries { -#line 171 "pure2-regex_06_boundaries.cpp2" +#line 183 "pure2-regex_06_boundaries.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -475,7 +478,7 @@ public: class func_0 { public: auto operator=(test_tests_06_boundaries const&) -> void = delete; -#line 192 "pure2-regex_06_boundaries.cpp2" +#line 204 "pure2-regex_06_boundaries.cpp2" }; auto main() -> int; @@ -595,6 +598,19 @@ auto main() -> int; } #line 112 "pure2-regex_06_boundaries.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_06_boundaries.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -617,7 +633,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -632,10 +648,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 171 "pure2-regex_06_boundaries.cpp2" +#line 183 "pure2-regex_06_boundaries.cpp2" auto test_tests_06_boundaries::run() const& -> void{ std::cout << "Running tests_06_boundaries:" << std::endl; test(regex_01, "01", R"(\ba\b)", "a-", "y", R"(-)", "-"); @@ -1529,7 +1545,7 @@ int i{0}; [[nodiscard]] auto test_tests_06_boundaries::regex_17_matcher::to_string() -> std::string{return R"(\B)"; } -#line 193 "pure2-regex_06_boundaries.cpp2" +#line 205 "pure2-regex_06_boundaries.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_06_boundaries()); } diff --git a/regression-tests/test-results/pure2-regex_07_short_classes.cpp b/regression-tests/test-results/pure2-regex_07_short_classes.cpp index 3e12cfef4..7a37ed3f9 100644 --- a/regression-tests/test-results/pure2-regex_07_short_classes.cpp +++ b/regression-tests/test-results/pure2-regex_07_short_classes.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_07_short_classes.cpp2" -#line 153 "pure2-regex_07_short_classes.cpp2" +#line 165 "pure2-regex_07_short_classes.cpp2" class test_tests_07_short_classes; @@ -19,13 +19,16 @@ class test_tests_07_short_classes; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_07_short_classes.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_07_short_classes.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_07_short_classes.cpp2" +#line 165 "pure2-regex_07_short_classes.cpp2" class test_tests_07_short_classes { -#line 178 "pure2-regex_07_short_classes.cpp2" +#line 190 "pure2-regex_07_short_classes.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -657,7 +660,7 @@ public: class func_0 { public: auto operator=(test_tests_07_short_classes const&) -> void = delete; -#line 206 "pure2-regex_07_short_classes.cpp2" +#line 218 "pure2-regex_07_short_classes.cpp2" }; auto main() -> int; @@ -777,6 +780,19 @@ auto main() -> int; } #line 112 "pure2-regex_07_short_classes.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_07_short_classes.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -799,7 +815,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -814,10 +830,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 178 "pure2-regex_07_short_classes.cpp2" +#line 190 "pure2-regex_07_short_classes.cpp2" auto test_tests_07_short_classes::run() const& -> void{ std::cout << "Running tests_07_short_classes:" << std::endl; test(regex_01, "01", R"(\w)", "a", "y", R"(-)", "-"); @@ -1983,7 +1999,7 @@ int i{0}; [[nodiscard]] auto test_tests_07_short_classes::regex_24_matcher::to_string() -> std::string{return R"([\D])"; } -#line 207 "pure2-regex_07_short_classes.cpp2" +#line 219 "pure2-regex_07_short_classes.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_07_short_classes()); } diff --git a/regression-tests/test-results/pure2-regex_08_alternatives.cpp b/regression-tests/test-results/pure2-regex_08_alternatives.cpp index 923344c60..73d79613c 100644 --- a/regression-tests/test-results/pure2-regex_08_alternatives.cpp +++ b/regression-tests/test-results/pure2-regex_08_alternatives.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_08_alternatives.cpp2" -#line 153 "pure2-regex_08_alternatives.cpp2" +#line 165 "pure2-regex_08_alternatives.cpp2" class test_tests_08_alternatives; @@ -19,13 +19,16 @@ class test_tests_08_alternatives; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_08_alternatives.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_08_alternatives.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_08_alternatives.cpp2" +#line 165 "pure2-regex_08_alternatives.cpp2" class test_tests_08_alternatives { -#line 156 "pure2-regex_08_alternatives.cpp2" +#line 168 "pure2-regex_08_alternatives.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -115,7 +118,7 @@ public: class func_1 { public: auto operator=(test_tests_08_alternatives const&) -> void = delete; -#line 162 "pure2-regex_08_alternatives.cpp2" +#line 174 "pure2-regex_08_alternatives.cpp2" }; auto main() -> int; @@ -235,6 +238,19 @@ auto main() -> int; } #line 112 "pure2-regex_08_alternatives.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_08_alternatives.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -257,7 +273,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -272,10 +288,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 156 "pure2-regex_08_alternatives.cpp2" +#line 168 "pure2-regex_08_alternatives.cpp2" auto test_tests_08_alternatives::run() const& -> void{ std::cout << "Running tests_08_alternatives:" << std::endl; test(regex_01, "01", R"(ab|cd)", "abc", "y", R"($&)", "ab"); @@ -521,7 +537,7 @@ int i{0}; [[nodiscard]] auto test_tests_08_alternatives::regex_02_matcher::to_string() -> std::string{return R"(ab|cd)"; } -#line 163 "pure2-regex_08_alternatives.cpp2" +#line 175 "pure2-regex_08_alternatives.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_08_alternatives()); } diff --git a/regression-tests/test-results/pure2-regex_09_groups.cpp b/regression-tests/test-results/pure2-regex_09_groups.cpp index 736248b87..6019e25a8 100644 --- a/regression-tests/test-results/pure2-regex_09_groups.cpp +++ b/regression-tests/test-results/pure2-regex_09_groups.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_09_groups.cpp2" -#line 153 "pure2-regex_09_groups.cpp2" +#line 165 "pure2-regex_09_groups.cpp2" class test_tests_09_groups; @@ -19,13 +19,16 @@ class test_tests_09_groups; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_09_groups.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_09_groups.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_09_groups.cpp2" +#line 165 "pure2-regex_09_groups.cpp2" class test_tests_09_groups { -#line 165 "pure2-regex_09_groups.cpp2" +#line 177 "pure2-regex_09_groups.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -319,7 +322,7 @@ public: class func_0 { public: auto operator=(test_tests_09_groups const&) -> void = delete; -#line 180 "pure2-regex_09_groups.cpp2" +#line 192 "pure2-regex_09_groups.cpp2" }; auto main() -> int; @@ -439,6 +442,19 @@ auto main() -> int; } #line 112 "pure2-regex_09_groups.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_09_groups.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -461,7 +477,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -476,10 +492,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 165 "pure2-regex_09_groups.cpp2" +#line 177 "pure2-regex_09_groups.cpp2" auto test_tests_09_groups::run() const& -> void{ std::cout << "Running tests_09_groups:" << std::endl; test(regex_01, "01", R"(()ef)", "def", "y", R"($&-$1)", "ef-"); @@ -1362,7 +1378,7 @@ int i{0}; [[nodiscard]] auto test_tests_09_groups::regex_11_matcher::to_string() -> std::string{return R"((a)b(c))"; } -#line 181 "pure2-regex_09_groups.cpp2" +#line 193 "pure2-regex_09_groups.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_09_groups()); } diff --git a/regression-tests/test-results/pure2-regex_10_escapes.cpp b/regression-tests/test-results/pure2-regex_10_escapes.cpp index 85a101d3a..ab395e4e9 100644 --- a/regression-tests/test-results/pure2-regex_10_escapes.cpp +++ b/regression-tests/test-results/pure2-regex_10_escapes.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_10_escapes.cpp2" -#line 153 "pure2-regex_10_escapes.cpp2" +#line 165 "pure2-regex_10_escapes.cpp2" class test_tests_10_escapes; @@ -19,13 +19,16 @@ class test_tests_10_escapes; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_10_escapes.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_10_escapes.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_10_escapes.cpp2" +#line 165 "pure2-regex_10_escapes.cpp2" class test_tests_10_escapes { -#line 174 "pure2-regex_10_escapes.cpp2" +#line 186 "pure2-regex_10_escapes.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -633,7 +636,7 @@ public: class func_0 { public: auto operator=(test_tests_10_escapes const&) -> void = delete; -#line 198 "pure2-regex_10_escapes.cpp2" +#line 210 "pure2-regex_10_escapes.cpp2" }; auto main() -> int; @@ -753,6 +756,19 @@ auto main() -> int; } #line 112 "pure2-regex_10_escapes.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_10_escapes.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -775,7 +791,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -790,10 +806,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 174 "pure2-regex_10_escapes.cpp2" +#line 186 "pure2-regex_10_escapes.cpp2" auto test_tests_10_escapes::run() const& -> void{ std::cout << "Running tests_10_escapes:" << std::endl; test(regex_01, "01", R"(a\(b)", "a(b", "y", R"($&-$1)", "a(b-"); @@ -2422,7 +2438,7 @@ int i{0}; [[nodiscard]] auto test_tests_10_escapes::regex_20_matcher::to_string() -> std::string{return R"(\101\o{102})"; } -#line 199 "pure2-regex_10_escapes.cpp2" +#line 211 "pure2-regex_10_escapes.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_10_escapes()); } diff --git a/regression-tests/test-results/pure2-regex_11_group_references.cpp b/regression-tests/test-results/pure2-regex_11_group_references.cpp index b07ad7e01..f4c118e45 100644 --- a/regression-tests/test-results/pure2-regex_11_group_references.cpp +++ b/regression-tests/test-results/pure2-regex_11_group_references.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_11_group_references.cpp2" -#line 153 "pure2-regex_11_group_references.cpp2" +#line 165 "pure2-regex_11_group_references.cpp2" class test_tests_11_group_references; @@ -19,13 +19,16 @@ class test_tests_11_group_references; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_11_group_references.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_11_group_references.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_11_group_references.cpp2" +#line 165 "pure2-regex_11_group_references.cpp2" class test_tests_11_group_references { -#line 178 "pure2-regex_11_group_references.cpp2" +#line 190 "pure2-regex_11_group_references.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -777,7 +780,7 @@ public: class func_1 { public: auto operator=(test_tests_11_group_references const&) -> void = delete; -#line 206 "pure2-regex_11_group_references.cpp2" +#line 218 "pure2-regex_11_group_references.cpp2" }; auto main() -> int; @@ -897,6 +900,19 @@ auto main() -> int; } #line 112 "pure2-regex_11_group_references.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_11_group_references.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -919,7 +935,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -934,10 +950,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 178 "pure2-regex_11_group_references.cpp2" +#line 190 "pure2-regex_11_group_references.cpp2" auto test_tests_11_group_references::run() const& -> void{ std::cout << "Running tests_11_group_references:" << std::endl; test(regex_01, "01", R"((foo)(\g-2))", "foofoo", "y", R"($1-$2)", "foo-foo"); @@ -3678,7 +3694,7 @@ int i{0}; [[nodiscard]] auto test_tests_11_group_references::regex_24_matcher::to_string() -> std::string{return R"(/(?as) (\w+) \k{ as } (\w+)/)"; } -#line 207 "pure2-regex_11_group_references.cpp2" +#line 219 "pure2-regex_11_group_references.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_11_group_references()); } diff --git a/regression-tests/test-results/pure2-regex_12_case_insensitive.cpp b/regression-tests/test-results/pure2-regex_12_case_insensitive.cpp index 595e7c8c1..780f43d3e 100644 --- a/regression-tests/test-results/pure2-regex_12_case_insensitive.cpp +++ b/regression-tests/test-results/pure2-regex_12_case_insensitive.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_12_case_insensitive.cpp2" -#line 153 "pure2-regex_12_case_insensitive.cpp2" +#line 165 "pure2-regex_12_case_insensitive.cpp2" class test_tests_12_case_insensitive; @@ -19,13 +19,16 @@ class test_tests_12_case_insensitive; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_12_case_insensitive.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_12_case_insensitive.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_12_case_insensitive.cpp2" +#line 165 "pure2-regex_12_case_insensitive.cpp2" class test_tests_12_case_insensitive { -#line 273 "pure2-regex_12_case_insensitive.cpp2" +#line 285 "pure2-regex_12_case_insensitive.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -4572,7 +4575,7 @@ public: class func_0 { public: auto operator=(test_tests_12_case_insensitive const&) -> void = delete; -#line 396 "pure2-regex_12_case_insensitive.cpp2" +#line 408 "pure2-regex_12_case_insensitive.cpp2" }; auto main() -> int; @@ -4692,6 +4695,19 @@ auto main() -> int; } #line 112 "pure2-regex_12_case_insensitive.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_12_case_insensitive.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -4714,7 +4730,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -4729,10 +4745,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 273 "pure2-regex_12_case_insensitive.cpp2" +#line 285 "pure2-regex_12_case_insensitive.cpp2" auto test_tests_12_case_insensitive::run() const& -> void{ std::cout << "Running tests_12_case_insensitive:" << std::endl; test(regex_01, "01", R"('abc'i)", "ABC", "y", R"($&)", "ABC"); @@ -19914,7 +19930,7 @@ int i{0}; [[nodiscard]] auto test_tests_12_case_insensitive::regex_99_matcher::to_string() -> std::string{return R"('((a)(b)c)(d)'i)"; } -#line 397 "pure2-regex_12_case_insensitive.cpp2" +#line 409 "pure2-regex_12_case_insensitive.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_12_case_insensitive()); } diff --git a/regression-tests/test-results/pure2-regex_13_possessive_modifier.cpp b/regression-tests/test-results/pure2-regex_13_possessive_modifier.cpp index 06c080b80..af21c800b 100644 --- a/regression-tests/test-results/pure2-regex_13_possessive_modifier.cpp +++ b/regression-tests/test-results/pure2-regex_13_possessive_modifier.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_13_possessive_modifier.cpp2" -#line 153 "pure2-regex_13_possessive_modifier.cpp2" +#line 165 "pure2-regex_13_possessive_modifier.cpp2" class test_tests_13_possessive_modifier; @@ -19,13 +19,16 @@ class test_tests_13_possessive_modifier; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_13_possessive_modifier.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_13_possessive_modifier.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_13_possessive_modifier.cpp2" +#line 165 "pure2-regex_13_possessive_modifier.cpp2" class test_tests_13_possessive_modifier { -#line 202 "pure2-regex_13_possessive_modifier.cpp2" +#line 214 "pure2-regex_13_possessive_modifier.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -2281,7 +2284,7 @@ public: class func_2 { public: auto operator=(test_tests_13_possessive_modifier const&) -> void = delete; -#line 254 "pure2-regex_13_possessive_modifier.cpp2" +#line 266 "pure2-regex_13_possessive_modifier.cpp2" }; auto main() -> int; @@ -2401,6 +2404,19 @@ auto main() -> int; } #line 112 "pure2-regex_13_possessive_modifier.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_13_possessive_modifier.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -2423,7 +2439,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -2438,10 +2454,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 202 "pure2-regex_13_possessive_modifier.cpp2" +#line 214 "pure2-regex_13_possessive_modifier.cpp2" auto test_tests_13_possessive_modifier::run() const& -> void{ std::cout << "Running tests_13_possessive_modifier:" << std::endl; test(regex_01, "01", R"(a++a)", "aaaaa", "n", R"(-)", "-"); @@ -10095,7 +10111,7 @@ int i{0}; [[nodiscard]] auto test_tests_13_possessive_modifier::regex_48_matcher::to_string() -> std::string{return R"(foo(aA|bB)?+b)"; } -#line 255 "pure2-regex_13_possessive_modifier.cpp2" +#line 267 "pure2-regex_13_possessive_modifier.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_13_possessive_modifier()); } diff --git a/regression-tests/test-results/pure2-regex_14_multiline_modifier.cpp b/regression-tests/test-results/pure2-regex_14_multiline_modifier.cpp index 338af1243..77ab52574 100644 --- a/regression-tests/test-results/pure2-regex_14_multiline_modifier.cpp +++ b/regression-tests/test-results/pure2-regex_14_multiline_modifier.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_14_multiline_modifier.cpp2" -#line 153 "pure2-regex_14_multiline_modifier.cpp2" +#line 165 "pure2-regex_14_multiline_modifier.cpp2" class test_tests_14_multiline_modifier; @@ -19,13 +19,16 @@ class test_tests_14_multiline_modifier; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_14_multiline_modifier.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_14_multiline_modifier.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_14_multiline_modifier.cpp2" +#line 165 "pure2-regex_14_multiline_modifier.cpp2" class test_tests_14_multiline_modifier { -#line 353 "pure2-regex_14_multiline_modifier.cpp2" +#line 365 "pure2-regex_14_multiline_modifier.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -5207,7 +5210,7 @@ public: class func_0 { public: auto operator=(test_tests_14_multiline_modifier const&) -> void = delete; -#line 556 "pure2-regex_14_multiline_modifier.cpp2" +#line 568 "pure2-regex_14_multiline_modifier.cpp2" }; auto main() -> int; @@ -5327,6 +5330,19 @@ auto main() -> int; } #line 112 "pure2-regex_14_multiline_modifier.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_14_multiline_modifier.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -5349,7 +5365,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -5364,10 +5380,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 353 "pure2-regex_14_multiline_modifier.cpp2" +#line 365 "pure2-regex_14_multiline_modifier.cpp2" auto test_tests_14_multiline_modifier::run() const& -> void{ std::cout << "Running tests_14_multiline_modifier:" << std::endl; test(regex_01, "01", R"(\Z)", "a\nb\n", "y", R"($-[0])", "3"); @@ -15669,7 +15685,7 @@ int i{0}; [[nodiscard]] auto test_tests_14_multiline_modifier::regex_99_matcher::to_string() -> std::string{return R"(ab$)"; } -#line 557 "pure2-regex_14_multiline_modifier.cpp2" +#line 569 "pure2-regex_14_multiline_modifier.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_14_multiline_modifier()); } diff --git a/regression-tests/test-results/pure2-regex_15_group_modifiers.cpp b/regression-tests/test-results/pure2-regex_15_group_modifiers.cpp index b0103954a..d0627954f 100644 --- a/regression-tests/test-results/pure2-regex_15_group_modifiers.cpp +++ b/regression-tests/test-results/pure2-regex_15_group_modifiers.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_15_group_modifiers.cpp2" -#line 153 "pure2-regex_15_group_modifiers.cpp2" +#line 165 "pure2-regex_15_group_modifiers.cpp2" class test_tests_15_group_modifiers; @@ -19,13 +19,16 @@ class test_tests_15_group_modifiers; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_15_group_modifiers.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_15_group_modifiers.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_15_group_modifiers.cpp2" +#line 165 "pure2-regex_15_group_modifiers.cpp2" class test_tests_15_group_modifiers { -#line 207 "pure2-regex_15_group_modifiers.cpp2" +#line 219 "pure2-regex_15_group_modifiers.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -1441,7 +1444,7 @@ public: class func_0 { public: auto operator=(test_tests_15_group_modifiers const&) -> void = delete; -#line 264 "pure2-regex_15_group_modifiers.cpp2" +#line 276 "pure2-regex_15_group_modifiers.cpp2" }; auto main() -> int; @@ -1561,6 +1564,19 @@ auto main() -> int; } #line 112 "pure2-regex_15_group_modifiers.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_15_group_modifiers.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -1583,7 +1599,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -1598,10 +1614,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 207 "pure2-regex_15_group_modifiers.cpp2" +#line 219 "pure2-regex_15_group_modifiers.cpp2" auto test_tests_15_group_modifiers::run() const& -> void{ std::cout << "Running tests_15_group_modifiers:" << std::endl; test(regex_01, "01", R"((?:(?i)a)b)", "ab", "y", R"($&)", "ab"); @@ -5577,7 +5593,7 @@ int i{0}; [[nodiscard]] auto test_tests_15_group_modifiers::regex_53_matcher::to_string() -> std::string{return R"('(?-n:(foo)(?n:(?:bar)))'n)"; } -#line 265 "pure2-regex_15_group_modifiers.cpp2" +#line 277 "pure2-regex_15_group_modifiers.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_15_group_modifiers()); } diff --git a/regression-tests/test-results/pure2-regex_16_perl_syntax_modifier.cpp b/regression-tests/test-results/pure2-regex_16_perl_syntax_modifier.cpp index 3d81c02e7..a50cf334b 100644 --- a/regression-tests/test-results/pure2-regex_16_perl_syntax_modifier.cpp +++ b/regression-tests/test-results/pure2-regex_16_perl_syntax_modifier.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_16_perl_syntax_modifier.cpp2" -#line 153 "pure2-regex_16_perl_syntax_modifier.cpp2" +#line 165 "pure2-regex_16_perl_syntax_modifier.cpp2" class test_tests_16_perl_syntax_modifier; @@ -19,13 +19,16 @@ class test_tests_16_perl_syntax_modifier; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_16_perl_syntax_modifier.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_16_perl_syntax_modifier.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_16_perl_syntax_modifier.cpp2" +#line 165 "pure2-regex_16_perl_syntax_modifier.cpp2" class test_tests_16_perl_syntax_modifier { -#line 187 "pure2-regex_16_perl_syntax_modifier.cpp2" +#line 199 "pure2-regex_16_perl_syntax_modifier.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -1051,7 +1054,7 @@ public: class func_0 { public: auto operator=(test_tests_16_perl_syntax_modifier const&) -> void = delete; -#line 224 "pure2-regex_16_perl_syntax_modifier.cpp2" +#line 236 "pure2-regex_16_perl_syntax_modifier.cpp2" }; auto main() -> int; @@ -1171,6 +1174,19 @@ auto main() -> int; } #line 112 "pure2-regex_16_perl_syntax_modifier.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_16_perl_syntax_modifier.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -1193,7 +1209,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -1208,10 +1224,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 187 "pure2-regex_16_perl_syntax_modifier.cpp2" +#line 199 "pure2-regex_16_perl_syntax_modifier.cpp2" auto test_tests_16_perl_syntax_modifier::run() const& -> void{ std::cout << "Running tests_16_perl_syntax_modifier:" << std::endl; test(regex_01, "01", R"(/\N {1}/x)", "abbbbc", "y", R"($&)", "a"); @@ -3276,7 +3292,7 @@ int i{0}; [[nodiscard]] auto test_tests_16_perl_syntax_modifier::regex_33_matcher::to_string() -> std::string{return R"(/[#]b/x)"; } -#line 225 "pure2-regex_16_perl_syntax_modifier.cpp2" +#line 237 "pure2-regex_16_perl_syntax_modifier.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_16_perl_syntax_modifier()); } diff --git a/regression-tests/test-results/pure2-regex_17_comments.cpp b/regression-tests/test-results/pure2-regex_17_comments.cpp index a566f273c..be7466eec 100644 --- a/regression-tests/test-results/pure2-regex_17_comments.cpp +++ b/regression-tests/test-results/pure2-regex_17_comments.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_17_comments.cpp2" -#line 153 "pure2-regex_17_comments.cpp2" +#line 165 "pure2-regex_17_comments.cpp2" class test_tests_17_comments; @@ -19,13 +19,16 @@ class test_tests_17_comments; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_17_comments.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_17_comments.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_17_comments.cpp2" +#line 165 "pure2-regex_17_comments.cpp2" class test_tests_17_comments { -#line 157 "pure2-regex_17_comments.cpp2" +#line 169 "pure2-regex_17_comments.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -131,7 +134,7 @@ public: class func_0 { public: auto operator=(test_tests_17_comments const&) -> void = delete; -#line 164 "pure2-regex_17_comments.cpp2" +#line 176 "pure2-regex_17_comments.cpp2" }; auto main() -> int; @@ -251,6 +254,19 @@ auto main() -> int; } #line 112 "pure2-regex_17_comments.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_17_comments.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -273,7 +289,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -288,10 +304,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 157 "pure2-regex_17_comments.cpp2" +#line 169 "pure2-regex_17_comments.cpp2" auto test_tests_17_comments::run() const& -> void{ std::cout << "Running tests_17_comments:" << std::endl; test(regex_01, "01", R"(^a(?#xxx){3}c)", "aaac", "y", R"($&)", "aaac"); @@ -555,7 +571,7 @@ int i{0}; [[nodiscard]] auto test_tests_17_comments::regex_03_matcher::to_string() -> std::string{return R"('foo'x)"; } -#line 165 "pure2-regex_17_comments.cpp2" +#line 177 "pure2-regex_17_comments.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_17_comments()); } diff --git a/regression-tests/test-results/pure2-regex_18_branch_reset.cpp b/regression-tests/test-results/pure2-regex_18_branch_reset.cpp index aaf375aa2..8d652d833 100644 --- a/regression-tests/test-results/pure2-regex_18_branch_reset.cpp +++ b/regression-tests/test-results/pure2-regex_18_branch_reset.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_18_branch_reset.cpp2" -#line 153 "pure2-regex_18_branch_reset.cpp2" +#line 165 "pure2-regex_18_branch_reset.cpp2" class test_tests_18_branch_reset; @@ -19,13 +19,16 @@ class test_tests_18_branch_reset; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_18_branch_reset.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_18_branch_reset.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_18_branch_reset.cpp2" +#line 165 "pure2-regex_18_branch_reset.cpp2" class test_tests_18_branch_reset { -#line 169 "pure2-regex_18_branch_reset.cpp2" +#line 181 "pure2-regex_18_branch_reset.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -953,7 +956,7 @@ public: class func_1 { public: auto operator=(test_tests_18_branch_reset const&) -> void = delete; -#line 188 "pure2-regex_18_branch_reset.cpp2" +#line 200 "pure2-regex_18_branch_reset.cpp2" }; auto main() -> int; @@ -1073,6 +1076,19 @@ auto main() -> int; } #line 112 "pure2-regex_18_branch_reset.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_18_branch_reset.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -1095,7 +1111,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -1110,10 +1126,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 169 "pure2-regex_18_branch_reset.cpp2" +#line 181 "pure2-regex_18_branch_reset.cpp2" auto test_tests_18_branch_reset::run() const& -> void{ std::cout << "Running tests_18_branch_reset:" << std::endl; test(regex_01, "01", R"((?|(a)))", "a", "y", R"($1-$+)", "a-a"); @@ -6994,7 +7010,7 @@ return -1; [[nodiscard]] auto test_tests_18_branch_reset::regex_15_matcher::to_string() -> std::string{return R"((?|(b)|()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(a)))"; } -#line 189 "pure2-regex_18_branch_reset.cpp2" +#line 201 "pure2-regex_18_branch_reset.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_18_branch_reset()); } diff --git a/regression-tests/test-results/pure2-regex_19_lookahead.cpp b/regression-tests/test-results/pure2-regex_19_lookahead.cpp index 610330ae5..3783e7a50 100644 --- a/regression-tests/test-results/pure2-regex_19_lookahead.cpp +++ b/regression-tests/test-results/pure2-regex_19_lookahead.cpp @@ -9,7 +9,7 @@ #line 1 "pure2-regex_19_lookahead.cpp2" -#line 153 "pure2-regex_19_lookahead.cpp2" +#line 165 "pure2-regex_19_lookahead.cpp2" class test_tests_19_lookahead; @@ -19,13 +19,16 @@ class test_tests_19_lookahead; [[nodiscard]] auto create_result(cpp2::impl::in resultExpr, auto const& r) -> std::string; #line 112 "pure2-regex_19_lookahead.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string; + +#line 124 "pure2-regex_19_lookahead.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void; -#line 153 "pure2-regex_19_lookahead.cpp2" +#line 165 "pure2-regex_19_lookahead.cpp2" class test_tests_19_lookahead { -#line 199 "pure2-regex_19_lookahead.cpp2" +#line 211 "pure2-regex_19_lookahead.cpp2" public: auto run() const& -> void; public: class regex_01_matcher { public: template class wrap { @@ -2213,7 +2216,7 @@ public: class func_1 { public: auto operator=(test_tests_19_lookahead const&) -> void = delete; -#line 248 "pure2-regex_19_lookahead.cpp2" +#line 260 "pure2-regex_19_lookahead.cpp2" }; auto main() -> int; @@ -2333,6 +2336,19 @@ auto main() -> int; } #line 112 "pure2-regex_19_lookahead.cpp2" +[[nodiscard]] auto sanitize(std::string str) -> std::string +{ + str = cpp2::string_util::replace_all(str, "\a", "\\a"); + str = cpp2::string_util::replace_all(str, "\f", "\\f"); + str = cpp2::string_util::replace_all(str, "\x1b", "\\e"); + str = cpp2::string_util::replace_all(str, "\n", "\\n"); + str = cpp2::string_util::replace_all(str, "\r", "\\r"); + str = cpp2::string_util::replace_all(str, "\t", "\\t"); + + return cpp2::move(str); +} + +#line 124 "pure2-regex_19_lookahead.cpp2" template auto test(M const& regex, cpp2::impl::in id, cpp2::impl::in regex_str, cpp2::impl::in str, cpp2::impl::in kind, cpp2::impl::in resultExpr, cpp2::impl::in resultExpected) -> void{ @@ -2355,7 +2371,7 @@ template auto test(M const& regex, cpp2::impl::in id, c auto result {create_result(resultExpr, cpp2::move(r))}; if (result != resultExpected) { - status = "Failure: Result is wrong. (is: " + cpp2::to_string(cpp2::move(result)) + ")"; + status = "Failure: Result is wrong. (is: " + cpp2::to_string(sanitize(cpp2::move(result))) + ")"; } } } @@ -2370,10 +2386,10 @@ template auto test(M const& regex, cpp2::impl::in id, c if (!(CPP2_UFCS(empty)(warning))) { warning += " "; } - std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(str) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(resultExpected) + "" << std::endl; + std::cout << "" + cpp2::to_string(id) + "_" + cpp2::to_string(kind) + ": " + cpp2::to_string(cpp2::move(status)) + " " + cpp2::to_string(cpp2::move(warning)) + "regex: " + cpp2::to_string(regex_str) + " parsed_regex: " + cpp2::to_string(CPP2_UFCS(to_string)(regex)) + " str: " + cpp2::to_string(sanitize(str)) + " result_expr: " + cpp2::to_string(resultExpr) + " expected_results " + cpp2::to_string(sanitize(resultExpected)) + "" << std::endl; } -#line 199 "pure2-regex_19_lookahead.cpp2" +#line 211 "pure2-regex_19_lookahead.cpp2" auto test_tests_19_lookahead::run() const& -> void{ std::cout << "Running tests_19_lookahead:" << std::endl; test(regex_01, "01", R"(a(?!b).)", "abad", "y", R"($&)", "ad"); @@ -9637,7 +9653,7 @@ int i{0}; [[nodiscard]] auto test_tests_19_lookahead::regex_53_matcher::to_string() -> std::string{return R"(a*(?!))"; } -#line 249 "pure2-regex_19_lookahead.cpp2" +#line 261 "pure2-regex_19_lookahead.cpp2" auto main() -> int{ CPP2_UFCS(run)(test_tests_19_lookahead()); }