diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-29 01:00:30 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-11-29 01:00:30 -0800 |
commit | afb467ea0270c59f9fdcad9fe5303d0ed526177c (patch) | |
tree | a8254143010d612908b9b4cc534bf4ab1da199a7 /050scenario.cc | |
parent | c9b98c21ffea7a2e48e10e01b80dabad42641e57 (diff) | |
download | mu-afb467ea0270c59f9fdcad9fe5303d0ed526177c.tar.gz |
2606 - handle cycles inside stash
The idea is that to-text-line should truncate blindly past some threshold, even if to-text isn't smart enough to avoid infinite loops. Maybe I should define a 'truncating buffer' which stops once it fills up. That would be an easy way to eliminate all infinite loops in to-text-line.
Diffstat (limited to '050scenario.cc')
-rw-r--r-- | 050scenario.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/050scenario.cc b/050scenario.cc index 21afe341..10c65e21 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -438,25 +438,22 @@ case TRACE_SHOULD_CONTAIN: { :(code) // simplified version of check_trace_contents() that emits errors rather // than just printing to stderr -bool check_trace(const string& expected) { +void check_trace(const string& expected) { Trace_stream->newline(); vector<trace_line> expected_lines = parse_trace(expected); - if (expected_lines.empty()) return true; + if (expected_lines.empty()) return; long long int curr_expected_line = 0; for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) { if (expected_lines.at(curr_expected_line).label != p->label) continue; if (expected_lines.at(curr_expected_line).contents != trim(p->contents)) continue; // match ++curr_expected_line; - if (curr_expected_line == SIZE(expected_lines)) { - return true; - } + if (curr_expected_line == SIZE(expected_lines)) return; } raise_error << "missing [" << expected_lines.at(curr_expected_line).contents << "] " << "in trace with label " << expected_lines.at(curr_expected_line).label << '\n' << end(); Passed = false; - return false; } vector<trace_line> parse_trace(const string& expected) { |