about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-27 14:45:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-27 14:45:51 -0700
commitd2cf04d1b1da0a8818f9c26060a8f8f0317daa34 (patch)
tree84f832fccaae6b7fa079b2c48783eb3a2b9e72ee
parent6e45be300efb0466ff753ffbbe5ffa80c235cf60 (diff)
downloadmu-d2cf04d1b1da0a8818f9c26060a8f8f0317daa34.tar.gz
3424
-rw-r--r--050scenario.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/050scenario.cc b/050scenario.cc
index 3d917c73..ce80614e 100644
--- a/050scenario.cc
+++ b/050scenario.cc
@@ -541,7 +541,6 @@ void check_trace(const string& expected) {
     ++curr_expected_line;
     if (curr_expected_line == SIZE(expected_lines)) return;
   }
-
   if (Current_scenario && !Scenario_testing_scenario)
     raise << "\nF - " << Current_scenario->name << ": missing [" << expected_lines.at(curr_expected_line).contents << "] "
           << "in trace with label '" << expected_lines.at(curr_expected_line).label << "'\n" << end();
@@ -560,6 +559,11 @@ vector<trace_line> parse_trace(const string& expected) {
     buf.at(i) = trim(buf.at(i));
     if (buf.at(i).empty()) continue;
     int delim = buf.at(i).find(": ");
+    if (delim == -1) {
+      raise << Current_scenario->name << ": lines in 'trace-should-contain' should be of the form <label>: <contents>. Both parts are required.\n" << end();
+      result.clear();
+      return result;
+    }
     result.push_back(trace_line(trim(buf.at(i).substr(0, delim)),  trim(buf.at(i).substr(delim+2))));
   }
   return result;