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 << ".";
 }
href='#n216'>216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299