about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-01 23:56:43 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-01 23:56:43 -0700
commit3f3976b501249551347376a80c6ab66f7836c35e (patch)
tree4d77fcba120ec39d8115059b21636ed81d1ea7b8
parentfb91839e1e78956e39c661b532137249f5fef451 (diff)
downloadmu-3f3976b501249551347376a80c6ab66f7836c35e.tar.gz
1237 - more lenient 'tangle'
If the scenario has no trace checks, just run it and check for segfaults
or whatnot.

The function you're running may also flag test errors internally.
-rw-r--r--cpp/tangle/030tangle.cc24
1 files changed, 7 insertions, 17 deletions
diff --git a/cpp/tangle/030tangle.cc b/cpp/tangle/030tangle.cc
index 407cd23e..fd01deba 100644
--- a/cpp/tangle/030tangle.cc
+++ b/cpp/tangle/030tangle.cc
@@ -282,14 +282,15 @@ list<Line>::iterator balancing_curly(list<Line>::iterator curr) {
 }
 
 // A scenario is one or more sessions separated by calls to CLEAR_TRACE ('===')
-//  A session is one or more lines of input
-//  followed by one or more lines expected in trace in order ('+')
-//  followed by one or more lines trace shouldn't include ('-')
-//  followed by one or more lines expressing counts of specific layers emitted in trace ('$')
+//  A session is 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 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.
 void emit_test(const string& name, list<Line>& lines, list<Line>& result) {
   result.push_back(Line("TEST("+name+")", front(lines).filename, front(lines).line_number-1));  // use line number of directive
-  while (any_non_input_line(lines)) {
+  while (!lines.empty()) {
     while (!lines.empty() && starts_with(front(lines).contents, "% ")) {
       result.push_back(Line("  "+front(lines).contents.substr(strlen("% ")), front(lines)));
       lines.pop_front();
@@ -318,18 +319,7 @@ void emit_test(const string& name, list<Line>& lines, list<Line>& result) {
       lines.pop_front();
     }
   }
-  if (lines.empty())
-    result.push_back(Line("}"));
-  else
-    result.push_back(Line("}", front(lines)));
-
-  while (!lines.empty() &&
-         (trim(front(lines).contents).empty() || starts_with(front(lines).contents, "//")))
-    lines.pop_front();
-  if (!lines.empty()) {
-    cerr << lines.size() << " unprocessed lines in scenario.\n";
-    exit(1);
-  }
+  result.push_back(Line("}"));
 }
 
 bool is_input(const string& line) {