about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-09-15 12:58:43 -0700
committerKartik Agaram <vc@akkartik.com>2018-09-15 12:58:43 -0700
commit8cf5912072d1046545572e6aa018ddf1c68737a5 (patch)
tree79a0cc89009be83d8f8e1fb1b79660f228171c14
parent76faa50bfb85443f478e2824319d6c8ea119df98 (diff)
downloadmu-8cf5912072d1046545572e6aa018ddf1c68737a5.tar.gz
4546
Bring Mu's trace harness in line with recent changes in SubX.
-rw-r--r--003trace.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/003trace.cc b/003trace.cc
index f0939e1c..be5f71a9 100644
--- a/003trace.cc
+++ b/003trace.cc
@@ -76,15 +76,6 @@ struct trace_line {
   trace_line(int d, string l, string c) :depth(d), label(l), contents(c) {}
 };
 
-:(before "End Globals")
-bool Hide_errors = false;  // if set, don't print even error trace lines to screen
-bool Dump_trace = false;  // if set, print trace lines to screen
-string Dump_label = "";  // if set, print trace lines matching a single label to screen
-:(before "End Reset")
-Hide_errors = false;
-Dump_trace = false;
-Dump_label = "";
-
 //: Support for tracing an entire run.
 //: Traces can have a lot of overhead, so only turn them on when asked.
 :(before "End Commandline Options(*arg)")
@@ -183,6 +174,15 @@ string trace_stream::readable_contents(string label) {
 trace_stream* Trace_stream = NULL;
 int Trace_errors = 0;  // used only when Trace_stream is NULL
 
+:(before "End Globals")
+bool Hide_errors = false;  // if set, don't print even error trace lines to screen
+bool Dump_trace = false;  // if set, print trace lines to screen
+string Dump_label = "";  // if set, print trace lines matching a single label to screen
+:(before "End Reset")
+Hide_errors = false;
+Dump_trace = false;
+Dump_label = "";
+
 :(before "End Includes")
 #define CLEAR_TRACE  delete Trace_stream, Trace_stream = new trace_stream;
 
@@ -361,6 +361,10 @@ bool trace_doesnt_contain(string label, string line) {
 
 bool trace_doesnt_contain(string expected) {
   vector<string> tmp = split_first(expected, ": ");
+  if (SIZE(tmp) == 1) {
+    raise << expected << ": missing label or contents in trace line\n" << end();
+    assert(false);
+  }
   return trace_doesnt_contain(tmp.at(0), tmp.at(1));
 }