Fix CI.
This commit is contained in:
Kartik Agaram 2018-07-25 15:26:58 -07:00
parent a18f5328eb
commit 00c2ca083e
2 changed files with 29 additions and 2 deletions

View File

@ -296,11 +296,14 @@ list<Line>::iterator balancing_curly(list<Line>::iterator curr) {
// one or more lines of escaped setup in C/C++ ('%')
// followed by one or more lines of input,
// followed optionally by (in order):
// one or more lines expected in trace in order ('+')
// one or more lines trace shouldn't include ('-')
// one or more lines expected in trace in order ('+') and one or more lines trace shouldn't include ('-')
// one or more lines expressing counts of specific layers emitted in trace ('$')
// a directive to print the trace just for debugging ('?')
// Remember to update is_input below if you add to this format.
//
// Allowing interleaving of '+' and '-' lines is a kludgy way to indicate that
// two sets of trace lines can occur in any order. We should come up with a
// better way to specify order-independence.
void emit_test(const string& name, list<Line>& lines, list<Line>& result) {
result.push_back(Line("void test_"+name+"() {", front(lines).filename, front(lines).line_number-1)); // use line number of directive
//? result.push_back("cerr << \""+name+"\\n\";"); // debug: uncomment this to print scenario names as you run them
@ -343,6 +346,7 @@ bool is_input(const string& line) {
void emit_input_lines(list<Line>& hunk, list<Line>& out) {
assert(!hunk.empty());
if (!is_input(front(hunk).contents)) return;
Line curr_out;
curr_out.line_number = hunk.front().line_number;
curr_out.filename = hunk.front().filename;

View File

@ -660,6 +660,29 @@ void test_tangle_can_handle_mu_comments_in_scenario() {
CHECK(lines.empty());
}
void test_tangle_can_interleave_present_and_absent_lines_to_kludgily_avoid_specifying_order() {
istringstream in(":(scenario does_bar)\n"
"abc def\n"
"+layer1: pqr\n"
"-absent\n"
"+layer2: xyz");
list<Line> lines;
tangle(in, lines);
CHECK_EQ(lines.front().contents, "void test_does_bar() {"); lines.pop_front();
CHECK_EQ(lines.front().contents, " run("); lines.pop_front();
CHECK_EQ(lines.front().contents, " \"abc def\\n\""); lines.pop_front();
CHECK_EQ(lines.front().contents, " );"); lines.pop_front();
CHECK_EQ(lines.front().contents, " CHECK_TRACE_CONTENTS("); lines.pop_front();
CHECK_EQ(lines.front().contents, " \"layer1: pqr\""); lines.pop_front();
CHECK_EQ(lines.front().contents, " );"); lines.pop_front();
CHECK_EQ(lines.front().contents, " CHECK_TRACE_DOESNT_CONTAIN(\"absent\");"); lines.pop_front();
CHECK_EQ(lines.front().contents, " CHECK_TRACE_CONTENTS("); lines.pop_front();
CHECK_EQ(lines.front().contents, " \"layer2: xyz\""); lines.pop_front();
CHECK_EQ(lines.front().contents, " );"); lines.pop_front();
CHECK_EQ(lines.front().contents, "}"); lines.pop_front();
CHECK(lines.empty());
}
//// helpers
void test_trim() {