Skip to content

Commit ccaf546

Browse files
committed
Updates for regression tests.
1 parent 47b2370 commit ccaf546

File tree

7 files changed

+40
-40
lines changed

7 files changed

+40
-40
lines changed

include/cpp2regex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2752,7 +2752,7 @@ size_t i{0};
27522752
str = string_util::replace_all(str, "\\", "\\\\");
27532753
str = string_util::replace_all(str, "\a", "\\a");
27542754
str = string_util::replace_all(str, "\f", "\\f");
2755-
str = string_util::replace_all(str, "\x1b", "\\e"); // TODO: A bug in gcc prevents us from using the safe "\\x{1b}". \x{1b} is replaced despite the escape.
2755+
//str = string_util::replace_all(str, "\x1b", "\\x{1b}"); // TODO: Add again after https://github.com/hsutter/cppfront/issues/1152 is fixed or concat strings are allowed.
27562756
str = string_util::replace_all(str, "\n", "\\n");
27572757
str = string_util::replace_all(str, "\r", "\\r");
27582758
str = string_util::replace_all(str, "\t", "\\t");

regression-tests/pure2-regex_10_escapes.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ test_tests_10_escapes: @regex type = {
189189
test(regex_14, "14", R"(foo(\v)bar)", "foo\rbar", "y", R"($1)", "\r");
190190
test(regex_15, "15", R"((\V)(\v))", "foo\rbar", "y", R"($1-$2)", "o-\r");
191191
test(regex_16, "16", R"((\v)(\V))", "foo\rbar", "y", R"($1-$2)", "\r-b");
192-
test(regex_17, "17", R"(foo\t\n\r\f\a\ebar)", "foo\t\n\r\f\a\ebar", "y", R"($&)", "foo\t\n\r\f\a\ebar");
192+
test(regex_17, "17", R"(foo\t\n\r\f\a\ebar)", "foo\t\n\r\f\abar", "y", R"($&)", "foo\t\n\r\f\abar");
193193
test(regex_18, "18", R"(foo\Kbar)", "foobar", "y", R"($&)", "bar");
194194
test(regex_19, "19", R"(\x41\x42)", "AB", "y", R"($&)", "AB");
195195
test(regex_20, "20", R"(\101\o{102})", "AB", "y", R"($&)", "AB");
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
In file included from mixed-bugfix-for-ufcs-non-local.cpp:6:
2-
../../../include/cpp2util.h:1136:1: error: lambda-expression in template parameter type
3-
1136 | [LAMBDADEFCAPT]< \
2+
../../../include/cpp2util.h:1139:1: error: lambda-expression in template parameter type
3+
1139 | [LAMBDADEFCAPT]< \
44
| ^
5-
../../../include/cpp2util.h:1173:59: note: in expansion of macro ‘CPP2_UFCS_’
6-
1173 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
5+
../../../include/cpp2util.h:1176:59: note: in expansion of macro ‘CPP2_UFCS_’
6+
1176 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
77
| ^~~~~~~~~~
88
mixed-bugfix-for-ufcs-non-local.cpp2:13:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
99
mixed-bugfix-for-ufcs-non-local.cpp2:13:36: error: template argument 1 is invalid
10-
../../../include/cpp2util.h:1136:1: error: lambda-expression in template parameter type
11-
1136 | [LAMBDADEFCAPT]< \
10+
../../../include/cpp2util.h:1139:1: error: lambda-expression in template parameter type
11+
1139 | [LAMBDADEFCAPT]< \
1212
| ^
13-
../../../include/cpp2util.h:1173:59: note: in expansion of macro ‘CPP2_UFCS_’
14-
1173 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
13+
../../../include/cpp2util.h:1176:59: note: in expansion of macro ‘CPP2_UFCS_’
14+
1176 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
1515
| ^~~~~~~~~~
1616
mixed-bugfix-for-ufcs-non-local.cpp2:21:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
1717
mixed-bugfix-for-ufcs-non-local.cpp2:21:36: error: template argument 1 is invalid
18-
../../../include/cpp2util.h:1136:1: error: lambda-expression in template parameter type
19-
1136 | [LAMBDADEFCAPT]< \
18+
../../../include/cpp2util.h:1139:1: error: lambda-expression in template parameter type
19+
1139 | [LAMBDADEFCAPT]< \
2020
| ^
21-
../../../include/cpp2util.h:1173:59: note: in expansion of macro ‘CPP2_UFCS_’
22-
1173 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
21+
../../../include/cpp2util.h:1176:59: note: in expansion of macro ‘CPP2_UFCS_’
22+
1176 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
2323
| ^~~~~~~~~~
2424
mixed-bugfix-for-ufcs-non-local.cpp2:31:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
2525
mixed-bugfix-for-ufcs-non-local.cpp2:31:36: error: template argument 1 is invalid
26-
../../../include/cpp2util.h:1136:1: error: lambda-expression in template parameter type
27-
1136 | [LAMBDADEFCAPT]< \
26+
../../../include/cpp2util.h:1139:1: error: lambda-expression in template parameter type
27+
1139 | [LAMBDADEFCAPT]< \
2828
| ^
29-
../../../include/cpp2util.h:1173:59: note: in expansion of macro ‘CPP2_UFCS_’
30-
1173 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
29+
../../../include/cpp2util.h:1176:59: note: in expansion of macro ‘CPP2_UFCS_’
30+
1176 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
3131
| ^~~~~~~~~~
3232
mixed-bugfix-for-ufcs-non-local.cpp2:33:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
3333
mixed-bugfix-for-ufcs-non-local.cpp2:33:36: error: template argument 1 is invalid
34-
../../../include/cpp2util.h:1136:1: error: lambda-expression in template parameter type
35-
1136 | [LAMBDADEFCAPT]< \
34+
../../../include/cpp2util.h:1139:1: error: lambda-expression in template parameter type
35+
1139 | [LAMBDADEFCAPT]< \
3636
| ^
37-
../../../include/cpp2util.h:1173:59: note: in expansion of macro ‘CPP2_UFCS_’
38-
1173 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
37+
../../../include/cpp2util.h:1176:59: note: in expansion of macro ‘CPP2_UFCS_’
38+
1176 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
3939
| ^~~~~~~~~~
4040
mixed-bugfix-for-ufcs-non-local.cpp2:21:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
4141
mixed-bugfix-for-ufcs-non-local.cpp2:21:36: error: template argument 1 is invalid

regression-tests/test-results/msvc-2022-c++20/pure2-assert-expected-not-null.cpp.output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pure2-assert-expected-not-null.cpp2(7): error C2143: syntax error: missing ';' b
66
pure2-assert-expected-not-null.cpp2(7): error C2143: syntax error: missing ';' before '}'
77
pure2-assert-expected-not-null.cpp2(9): error C2065: 'ex': undeclared identifier
88
pure2-assert-expected-not-null.cpp2(9): error C2672: 'cpp2::impl::assert_not_null': no matching overloaded function found
9-
..\..\..\include\cpp2util.h(639): note: could be 'decltype(auto) cpp2::impl::assert_not_null(_T0 &&)'
9+
D:␇\cppfront\cppfront\include\cpp2util.h(643): note: could be 'decltype(auto) cpp2::impl::assert_not_null(_T0 &&)'
1010
pure2-assert-expected-not-null.cpp2(14): error C2039: 'expected': is not a member of 'std'
1111
predefined C++ types (compiler internal)(347): note: see declaration of 'std'
1212
pure2-assert-expected-not-null.cpp2(14): error C2062: type 'int' unexpected
@@ -19,4 +19,4 @@ pure2-assert-expected-not-null.cpp2(14): note: while trying to match the argumen
1919
pure2-assert-expected-not-null.cpp2(14): error C2143: syntax error: missing ';' before '}'
2020
pure2-assert-expected-not-null.cpp2(15): error C2065: 'ex': undeclared identifier
2121
pure2-assert-expected-not-null.cpp2(15): error C2672: 'cpp2::impl::assert_not_null': no matching overloaded function found
22-
..\..\..\include\cpp2util.h(639): note: could be 'decltype(auto) cpp2::impl::assert_not_null(_T0 &&)'
22+
D:␇\cppfront\cppfront\include\cpp2util.h(643): note: could be 'decltype(auto) cpp2::impl::assert_not_null(_T0 &&)'

regression-tests/test-results/msvc-2022-c++latest/pure2-regex_10_escapes.cpp.execution

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@ Running tests_10_escapes:
99
08_y: OK regex: foo(\h)bar parsed_regex: foo(\h)bar str: foo bar result_expr: $1 expected_results
1010
09_y: OK regex: (\H)(\h) parsed_regex: (\H)(\h) str: foo bar result_expr: $1-$2 expected_results o-
1111
10_y: OK regex: (\h)(\H) parsed_regex: (\h)(\H) str: foo bar result_expr: $1-$2 expected_results -b
12-
11_y: OK regex: foo(\v+)bar parsed_regex: foo(\v+)bar str: foo
13-
12+
11_y: OK regex: foo(\v+)bar parsed_regex: foo(\v+)bar str: foo
1413

15-
bar result_expr: $1 expected_results
16-
1714

15+
bar result_expr: $1 expected_results
1816

19-
12_y: OK regex: (\V+)(\v) parsed_regex: (\V+)(\v) str: foo
20-
2117

22-
bar result_expr: $1-$2 expected_results foo-
23-
13_y: OK regex: (\v+)(\V) parsed_regex: (\v+)(\V) str: foo
24-
2518

26-
bar result_expr: $1-$2 expected_results
27-
19+
12_y: OK regex: (\V+)(\v) parsed_regex: (\V+)(\v) str: foo
20+
21+
22+
bar result_expr: $1-$2 expected_results foo-
23+
13_y: OK regex: (\v+)(\V) parsed_regex: (\v+)(\V) str: foo
24+
25+
26+
bar result_expr: $1-$2 expected_results
27+
2828

2929
-b
30-
14_y: OK regex: foo(\v)bar parsed_regex: foo(\v)bar str: foobar result_expr: $1 expected_results
31-
15_y: OK regex: (\V)(\v) parsed_regex: (\V)(\v) str: foobar result_expr: $1-$2 expected_results o-
30+
14_y: OK regex: foo(\v)bar parsed_regex: foo(\v)bar str: foobar result_expr: $1 expected_results
31+
15_y: OK regex: (\V)(\v) parsed_regex: (\V)(\v) str: foobar result_expr: $1-$2 expected_results o-
3232
16_y: OK regex: (\v)(\V) parsed_regex: (\v)(\V) str: foobar result_expr: $1-$2 expected_results -b
3333
17_y: OK regex: foo\t\n\r\f\a\ebar parsed_regex: foo\t\n\r\f\a\ebar str: foo
3434
ebar result_expr: $& expected_results foo

regression-tests/test-results/pure2-regex_10_escapes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ template<typename M> auto test(M const& regex, cpp2::impl::in<std::string> id, c
811811
test(regex_14, "14", R"(foo(\v)bar)", "foo\rbar", "y", R"($1)", "\r");
812812
test(regex_15, "15", R"((\V)(\v))", "foo\rbar", "y", R"($1-$2)", "o-\r");
813813
test(regex_16, "16", R"((\v)(\V))", "foo\rbar", "y", R"($1-$2)", "\r-b");
814-
test(regex_17, "17", R"(foo\t\n\r\f\a\ebar)", "foo\t\n\r\f\a\ebar", "y", R"($&)", "foo\t\n\r\f\a\ebar");
814+
test(regex_17, "17", R"(foo\t\n\r\f\a\ebar)", "foo\t\n\r\f\abar", "y", R"($&)", "foo\t\n\r\f\abar");
815815
test(regex_18, "18", R"(foo\Kbar)", "foobar", "y", R"($&)", "bar");
816816
test(regex_19, "19", R"(\x41\x42)", "AB", "y", R"($&)", "AB");
817817
test(regex_20, "20", R"(\101\o{102})", "AB", "y", R"($&)", "AB");
@@ -2211,7 +2211,7 @@ int i{0};
22112211
auto r {ctx.pass(cur)};
22122212
do {
22132213

2214-
std::array<char,12 + 1> str_tmp_0 {"foo\t\n\r\f\a\ebar"};
2214+
std::array<char,12 + 1> str_tmp_0 {"foo\t\n\r\f\abar"};
22152215
if (cpp2::impl::cmp_less(std::distance(r.pos, ctx.end),12)) {
22162216
r.matched = false;
22172217
break;

source/regex.h2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ char_token: @polymorphic_base type = {
12531253
str = string_util::replace_all(str, "\\", "\\\\");
12541254
str = string_util::replace_all(str, "\a", "\\a");
12551255
str = string_util::replace_all(str, "\f", "\\f");
1256-
str = string_util::replace_all(str, "\x1b", "\\e"); // TODO: A bug in gcc prevents us from using the safe "\\x{1b}". \x{1b} is replaced despite the escape.
1256+
//str = string_util::replace_all(str, "\x1b", "\\x{1b}"); // TODO: Add again after https://github.com/hsutter/cppfront/issues/1152 is fixed or concat strings are allowed.
12571257
str = string_util::replace_all(str, "\n", "\\n");
12581258
str = string_util::replace_all(str, "\r", "\\r");
12591259
str = string_util::replace_all(str, "\t", "\\t");

0 commit comments

Comments
 (0)