about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--029tools.cc5
-rw-r--r--082persist.cc6
2 files changed, 8 insertions, 3 deletions
diff --git a/029tools.cc b/029tools.cc
index 45d6a20a..8285969e 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -186,8 +186,11 @@ case _SYSTEM: {
     raise << current_recipe_name() << ": '$system' requires exactly one ingredient, but got none\n" << end();
     break;
   }
-  int status = system(current_instruction().ingredients.at(0).name.c_str());
   products.resize(1);
+  // ignore 'system' calls in tests since anything we do with them is by
+  // definition impossible to test through mu.
+  if (Current_scenario) break;
+  int status = system(current_instruction().ingredients.at(0).name.c_str());
   products.at(0).push_back(status);
   break;
 }
diff --git a/082persist.cc b/082persist.cc
index 79b9842f..d663773c 100644
--- a/082persist.cc
+++ b/082persist.cc
@@ -15,6 +15,7 @@ case RESTORE: {
   if (!scalar(ingredients.at(0)))
     raise << current_recipe_name() << ": first ingredient of 'restore' should be a literal string, but got " << current_instruction().ingredients.at(0).to_string() << '\n' << end();
   products.resize(1);
+  if (Current_scenario) break;  // do nothing in tests
   string filename = current_instruction().ingredients.at(0).name;
   if (!is_literal(current_instruction().ingredients.at(0)))
     filename = to_string(ingredients.at(0).at(0));
@@ -57,12 +58,13 @@ case SAVE: {
   }
   if (!scalar(ingredients.at(0)))
     raise << current_recipe_name() << ": first ingredient of 'save' should be a literal string, but got " << current_instruction().ingredients.at(0).to_string() << '\n' << end();
+  if (!scalar(ingredients.at(1)))
+    raise << current_recipe_name() << ": second ingredient of 'save' should be an address:array:character, but got " << current_instruction().ingredients.at(1).to_string() << '\n' << end();
+  if (Current_scenario) break;  // do nothing in tests
   string filename = current_instruction().ingredients.at(0).name;
   if (!is_literal(current_instruction().ingredients.at(0)))
     filename = to_string(ingredients.at(0).at(0));
   ofstream fout(("lesson/"+filename).c_str());
-  if (!scalar(ingredients.at(1)))
-    raise << current_recipe_name() << ": second ingredient of 'save' should be an address:array:character, but got " << current_instruction().ingredients.at(1).to_string() << '\n' << end();
   string contents = read_mu_string(ingredients.at(1).at(0));
   fout << contents;
   fout.close();