Skip to content

Commit a0d13e1

Browse files
committed
Added missing headers to a test case, closes #15
1 parent bf5998a commit a0d13e1

3 files changed

+15
-9
lines changed

regression-tests/mixed-captures-in-expressions-and-postconditions.cpp2

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

2+
#include <algorithm>
3+
#include <vector>
4+
25
main: () -> int = {
3-
vec: std::vector<std::string>
6+
vec: std::vector<std::string>
47
= ("hello", "2022");
58

69
y: std::string = "\n";
@@ -13,7 +16,7 @@ main: () -> int = {
1316

1417
vec: std::vector<int> = ();
1518

16-
insert_at: (where: int, val: int)
19+
insert_at: (where: int, val: int)
1720
[[pre: 0 <= where && where <= vec.ssize()]]
1821
[[post: vec.ssize() == vec.ssize()$ + 1]]
1922
= {

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
// ----- Cpp2 support -----
22
#include "cpp2util.h"
33

4+
#line 1 "mixed-captures-in-expressions-and-postconditions.cpp2"
5+
6+
#include <algorithm>
7+
#include <vector>
48

5-
#line 2 "mixed-captures-in-expressions-and-postconditions.cpp2"
69
[[nodiscard]] auto main() -> int;
7-
#line 14 "mixed-captures-in-expressions-and-postconditions.cpp2"
8-
#line 16 "mixed-captures-in-expressions-and-postconditions.cpp2"
10+
#line 17 "mixed-captures-in-expressions-and-postconditions.cpp2"
11+
#line 19 "mixed-captures-in-expressions-and-postconditions.cpp2"
912
auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void;
1013

1114
//=== Cpp2 definitions ==========================================================
1215

13-
#line 1 "mixed-captures-in-expressions-and-postconditions.cpp2"
16+
#line 4 "mixed-captures-in-expressions-and-postconditions.cpp2"
1417

1518
[[nodiscard]] auto main() -> int{
1619
std::vector<std::string> vec {
@@ -29,8 +32,8 @@ std::vector<int> vec { };
2932
auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void
3033
{
3134
cpp2::Default.expects(0 <= where && where <= CPP2_UFCS_0(ssize, vec), "");
32-
auto post_18_5 = cpp2::finally_success([_0 = CPP2_UFCS_0(ssize, vec)]{cpp2::Default.expects(CPP2_UFCS_0(ssize, vec) == _0 + 1, "");} );
33-
#line 18 "mixed-captures-in-expressions-and-postconditions.cpp2"
35+
auto post_21_5 = cpp2::finally_success([_0 = CPP2_UFCS_0(ssize, vec)]{cpp2::Default.expects(CPP2_UFCS_0(ssize, vec) == _0 + 1, "");} );
36+
#line 21 "mixed-captures-in-expressions-and-postconditions.cpp2"
3437

3538

3639
CPP2_UFCS(insert, vec, CPP2_UFCS_0(begin, vec) + where, val);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
mixed-captures-in-expressions-and-postconditions.cpp2... ok (all Cpp2, passes safety checks)
1+
mixed-captures-in-expressions-and-postconditions.cpp2... ok (mixed Cpp1/Cpp2, Cpp2 code passes safety checks)
22

0 commit comments

Comments
 (0)