about summary refs log tree commit diff stats
path: root/cpp/050scenario.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-04 10:31:52 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-04 10:31:52 -0700
commitde49fb426aa44984d308f5856ec836360ba0bdce (patch)
tree5522203f99d3d387439c4cd0385e0375ccd8ed0d /cpp/050scenario.cc
parenta11d9c4a3375906bf8ae1117c6043776d2f08d17 (diff)
downloadmu-de49fb426aa44984d308f5856ec836360ba0bdce.tar.gz
1248 - syntax for using screens in scenarios
Still ugly as hell.
Diffstat (limited to 'cpp/050scenario.cc')
-rw-r--r--cpp/050scenario.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/cpp/050scenario.cc b/cpp/050scenario.cc
index 90a4fe64..bc60fcbc 100644
--- a/cpp/050scenario.cc
+++ b/cpp/050scenario.cc
@@ -79,26 +79,22 @@ scenario parse_scenario(istream& in) {
 }
 
 void run_mu_scenario(const scenario& s) {
-  setup();
-  // In this layer we're writing tangle scenarios about mu scenarios.
-  // Don't need to set Trace_file and Trace_stream in that situation.
-  // Hackily simulate a conditional START_TRACING_UNTIL_END_OF_SCOPE.
-  bool temporary_trace_file = Trace_file.empty();
-  if (temporary_trace_file) Trace_file = s.name;
-//?   cerr << Trace_file << '\n'; //? 1
-  bool delete_trace_stream = !Trace_stream;
-  if (delete_trace_stream) Trace_stream = new trace_stream;
-//?   START_TRACING_UNTIL_END_OF_SCOPE;
+  bool not_already_inside_test = !Trace_stream;
+  if (not_already_inside_test) {
+    Trace_file = s.name;
+    Trace_stream = new trace_stream;
+    setup();
+  }
   run("recipe "+s.name+" [ " + s.to_run + " ]");
-  teardown();
-  if (delete_trace_stream) {
+  if (not_already_inside_test) {
+    teardown();
     ofstream fout((Trace_dir+Trace_file).c_str());
     fout << Trace_stream->readable_contents("");
     fout.close();
     delete Trace_stream;
     Trace_stream = NULL;
+    Trace_file = "";
   }
-  if (temporary_trace_file) Trace_file = "";
 }
 
 :(before "End Command Handlers")
@@ -110,6 +106,7 @@ else if (command == "scenario") {
 time_t mu_time; time(&mu_time);
 cerr << "\nMu tests: " << ctime(&mu_time);
 for (size_t i = 0; i < Scenarios.size(); ++i) {
+//?   cerr << Passed << '\n'; //? 1
   run_mu_scenario(Scenarios[i]);
   if (Passed) cerr << ".";
 }