Skip to content

Commit f00f86b

Browse files
committed
Added -n and -s to regression test compilations
1 parent fd3c491 commit f00f86b

12 files changed

+19
-19
lines changed

regression-tests/run-tests.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ copy ..\*.cpp2 .
77
set count=0
88
for %%f in (mixed-*.cpp2) do (
99
echo Starting cppfront.exe %%f
10-
C:\GitHub\cppfront\x64\Debug\cppfront.exe %%f > %%f.output 2>&1
10+
C:\GitHub\cppfront\x64\Debug\cppfront.exe -n -s %%f > %%f.output 2>&1
1111
del %%f
1212
set /a count+=1
1313
)
1414
for %%f in (pure2-*.cpp2) do (
1515
echo Starting cppfront.exe %%f -p
16-
C:\GitHub\cppfront\x64\Debug\cppfront.exe %%f -p > %%f.output 2>&1
16+
C:\GitHub\cppfront\x64\Debug\cppfront.exe -n -s -p %%f > %%f.output 2>&1
1717
del %%f
1818
set /a count+=1
1919
)

regression-tests/test-results/mixed-bounds-check.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
[[nodiscard]] auto main() -> int{
1515
std::vector v { 1, 2, 3, 4, 5, -999 };
1616
CPP2_UFCS_0(pop_back, v);
17-
std::cout << v[5] << "\n";
17+
std::cout << cpp2::assert_in_bounds(v, 5) << "\n";
1818
}

regression-tests/test-results/mixed-captures-in-expressions-and-postconditions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void;
2020
"hello", "2022" };
2121

2222
std::string y { "\n" };
23-
auto callback { [_0 = (&y)](auto const& x){std::cout << x << *_0;} };
23+
auto callback { [_0 = (&y)](auto const& x){std::cout << x << *cpp2::assert_not_null(_0);} };
2424

2525
std::ranges::for_each( vec, callback );
2626
y = "-ish\n";

regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
std::string y { "\n" };
2424
std::ranges::for_each( view, [_0 = (&y)](auto const& x){
25-
std::cout << (*(_0)).c_str() << x << *_0;
25+
std::cout << (*cpp2::assert_not_null((_0))).c_str() << x << *cpp2::assert_not_null(_0);
2626
} );
2727

2828
auto callback { [](auto& x) { return x += "-ish"; } };

regression-tests/test-results/mixed-lifetime-safety-and-null-contracts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ auto call_my_framework(cpp2::in<const char *> msg) -> void;
3030

3131
auto try_pointer_stuff() -> void{
3232
int* p { null_from_cpp1() };
33-
*p = 42; // deliberate null dereference
33+
*cpp2::assert_not_null(p) = 42;// deliberate null dereference
3434
// to show -n
3535
}
3636

regression-tests/test-results/mixed-lifetime-safety-pointer-init-4.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ auto print_and_decorate(auto const& thing) -> void;
2929
p.construct(&x);
3030
}
3131

32-
print_and_decorate( *p.value());
32+
print_and_decorate( *cpp2::assert_not_null(p.value()));
3333
}
3434

3535
auto print_and_decorate(auto const& thing) -> void {

regression-tests/test-results/mixed-postfix-expression-custom-formatting.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ auto call(auto const& v, auto const& w, auto const& x, auto const& y, auto const
1717

1818
[[nodiscard]] auto test(auto const& a) -> std::string{
1919
return call( a,
20-
++*a.b(a.c), "hello", /* polite
20+
++*cpp2::assert_not_null(a.b(a.c)), "hello", /* polite
2121
greeting
2222
goes here */ " there",
23-
a.d.e( ++(*a.f).g(), // because f is foobar
23+
a.d.e( ++(*cpp2::assert_not_null(a.f)).g(), // because f is foobar
2424
a.h.i(),
2525
CPP2_UFCS(j, a, a.k, a.l))
2626
);

regression-tests/test-results/mixed-test-parens.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ constexpr int a = 1;
1717

1818
[[nodiscard]] auto main() -> int{
1919
std::vector<int> v { 1, 2, 3 };
20-
std::cout << (1 + 2) * (3 + v[0]);
20+
std::cout << (1 + 2) * (3 + cpp2::assert_in_bounds(v, 0));
2121
f<(1 > 2)>(3, 4);
2222
f< a + a>(5, 6);
2323
}

regression-tests/test-results/mixed-type-safety-1.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ auto print(cpp2::in<std::string> msg, cpp2::in<bool> b) -> void
4545

4646
auto c { cpp2_new<Circle>() }; // safe by construction
4747
Shape* s { CPP2_UFCS_0(get, c) }; // safe by Lifetime
48-
print("\ns* is Shape? ", cpp2::is<Shape>(*s));
49-
print( "s* is Circle? ", cpp2::is<Circle>(*s));
50-
print( "s* is Square? ", cpp2::is<Square>(*s));
48+
print("\ns* is Shape? ", cpp2::is<Shape>(*cpp2::assert_not_null(s)));
49+
print( "s* is Circle? ", cpp2::is<Circle>(*cpp2::assert_not_null(s)));
50+
print( "s* is Square? ", cpp2::is<Square>(*cpp2::assert_not_null(s)));
5151
}

regression-tests/test-results/pure2-bounds-safety-span.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ auto print_and_decorate(auto const& thing) -> void;
2222

2323
auto i { 0 };
2424
for( ; i < CPP2_UFCS_0(ssize, s); ++i ) {
25-
print_and_decorate( s[i] );
25+
print_and_decorate( cpp2::assert_in_bounds(s, i));
2626
}
2727
}
2828

regression-tests/test-results/pure2-intro-example-three-loops.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ auto decorate_and_print(auto& thing) -> void{
3030
std::span<std::string> view { words };
3131

3232
auto i { cpp2_new<int>(0) };
33-
for( ; *i < CPP2_UFCS_0(size, view); ++*i ) {
34-
print( view[*i] );
33+
for( ; *cpp2::assert_not_null(i) < CPP2_UFCS_0(size, view); ++*cpp2::assert_not_null(i) ) {
34+
print( cpp2::assert_in_bounds(view, *cpp2::assert_not_null(i)));
3535
}
3636

3737
do {
3838
std::cout << std::setw(4) << "**";
39-
} while ( *i > 1 && [&]{ --*i ; return true; }() );
39+
} while ( *cpp2::assert_not_null(i) > 1 && [&]{ --*cpp2::assert_not_null(i) ; return true; }() );
4040

4141
std::cout << "\n";
4242
for ( auto&& cpp2_range = words; auto& word : cpp2_range )

regression-tests/test-results/run-tests.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ copy ..\*.cpp2 .
77
set count=0
88
for %%f in (mixed-*.cpp2) do (
99
echo Starting cppfront.exe %%f
10-
C:\GitHub\cppfront\x64\Debug\cppfront.exe %%f > %%f.output 2>&1
10+
C:\GitHub\cppfront\x64\Debug\cppfront.exe -n -s %%f > %%f.output 2>&1
1111
del %%f
1212
set /a count+=1
1313
)
1414
for %%f in (pure2-*.cpp2) do (
1515
echo Starting cppfront.exe %%f -p
16-
C:\GitHub\cppfront\x64\Debug\cppfront.exe %%f -p > %%f.output 2>&1
16+
C:\GitHub\cppfront\x64\Debug\cppfront.exe -n -s -p %%f > %%f.output 2>&1
1717
del %%f
1818
set /a count+=1
1919
)

0 commit comments

Comments
 (0)