about summary refs log tree commit diff stats
path: root/050scenario.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-27 23:13:57 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-27 23:13:57 -0700
commitdd0846dc4efffbf1467af457d84c70f5a86a8583 (patch)
tree8fb293451ee091b25ad8968fc96285fe055086cf /050scenario.cc
parent83df835077a398103cbc67edc033dfe5d6dd401e (diff)
downloadmu-dd0846dc4efffbf1467af457d84c70f5a86a8583.tar.gz
1671 - better separate setup from code under test
Requires better support for special variable names in scenarios like
'screen' and 'console'.
Diffstat (limited to '050scenario.cc')
-rw-r--r--050scenario.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/050scenario.cc b/050scenario.cc
index 6ced90df..5ca64b48 100644
--- a/050scenario.cc
+++ b/050scenario.cc
@@ -138,10 +138,11 @@ void run_mu_scenario(const scenario& s) {
     Trace_stream = new trace_stream;
     setup();
   }
-//?   cerr << '^' << s.to_run << "$\n"; //? 4
   assert(Routines.empty());
-  run("recipe "+s.name+" [ " + s.to_run + " ]");
-//?   cerr << s.name << " done\n"; //? 1
+  vector<recipe_number> tmp = load("recipe "+s.name+" [ "+s.to_run+" ]");
+  bind_special_scenario_names(tmp.at(0));
+  transform_all();
+  run(tmp.front());
   if (not_already_inside_test && Trace_stream) {
     teardown();
     ofstream fout((Trace_dir+Trace_file).c_str());
@@ -180,14 +181,21 @@ case RUN: {
   tmp << "recipe run" << Next_recipe_number << " [ " << current_instruction().ingredients.at(0).name << " ]";
 //?   Show_rest_of_stream = true; //? 1
   vector<recipe_number> tmp_recipe = load(tmp.str());
-  // Predefined Scenario Locals In Run.
-  // End Predefined Scenario Locals In Run.
+  bind_special_scenario_names(tmp_recipe.at(0));
   transform_all();
 //?   cout << tmp_recipe.at(0) << ' ' << Recipe_number["main"] << '\n'; //? 1
   Current_routine->calls.push_front(call(tmp_recipe.at(0)));
   continue;  // not done with caller; don't increment current_step_index()
 }
 
+// Some variables for fake resources always get special addresses in
+// scenarios.
+:(code)
+void bind_special_scenario_names(recipe_number r) {
+  // Special Scenario Variable Names(r)
+  // End Special Scenario Variable Names(r)
+}
+
 :(scenario run_multiple)
 recipe main [
   run [