about summary refs log tree commit diff stats
path: root/011load.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-03-20 00:48:04 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-03-20 00:55:33 -0700
commit2429c65cce16a11841212a71ec2bb50373aa54d4 (patch)
tree97c5f2fff44f80ea1a02d0476b9e31b5d44d1d50 /011load.cc
parent3ac523393d15d51b0fd1b042eab4f7cb539f68a9 (diff)
downloadmu-2429c65cce16a11841212a71ec2bb50373aa54d4.tar.gz
2799 - new approach to undoing changes in tests
As outlined at the end of 2797. This worked out surprisingly well. Now
the snapshotting code touches fewer layers, and it's much better
behaved, with less need for special-case logic, particularly inside
run_interactive(). 30% slower, but should hopefully not cause any more
bugs.
Diffstat (limited to '011load.cc')
-rw-r--r--011load.cc20
1 files changed, 0 insertions, 20 deletions
diff --git a/011load.cc b/011load.cc
index ee8df684..d71a67b5 100644
--- a/011load.cc
+++ b/011load.cc
@@ -60,8 +60,6 @@ int slurp_recipe(istream& in) {
   slurp_body(in, result);
   // End Recipe Body(result)
   put(Recipe, get(Recipe_ordinal, result.name), result);
-  // track added recipes because we may need to undo them in tests; see below
-  Recently_added_recipes.push_back(get(Recipe_ordinal, result.name));
   return get(Recipe_ordinal, result.name);
 }
 
@@ -228,24 +226,6 @@ void show_rest_of_stream(istream& in) {
   exit(0);
 }
 
-//: Have tests clean up any recipes they added.
-:(before "End Globals")
-vector<recipe_ordinal> Recently_added_recipes;
-int Reserved_for_tests = 1000;
-:(before "End Setup")
-clear_recently_added_recipes();
-:(code)
-void clear_recently_added_recipes() {
-  for (int i = 0; i < SIZE(Recently_added_recipes); ++i) {
-    if (Recently_added_recipes.at(i) >= Reserved_for_tests  // don't renumber existing recipes, like 'interactive'
-        && contains_key(Recipe, Recently_added_recipes.at(i)))  // in case previous test had duplicate definitions
-      Recipe_ordinal.erase(get(Recipe, Recently_added_recipes.at(i)).name);
-    Recipe.erase(Recently_added_recipes.at(i));
-  }
-  // Clear Other State For Recently_added_recipes
-  Recently_added_recipes.clear();
-}
-
 :(scenario parse_comment_outside_recipe)
 # this comment will be dropped by the tangler, so we need a dummy recipe to stop that
 def f1 [