From 3f3976b501249551347376a80c6ab66f7836c35e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 1 May 2015 23:56:43 -0700 Subject: 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. --- cpp/tangle/030tangle.cc | 24 +++++++----------------- 1 file 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::iterator balancing_curly(list::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& lines, list& 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& lines, list& 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) { -- cgit 1.4.1-2-gfad0