Index: test/mjsunit/debug-liveedit-1.js |
diff --git a/test/mjsunit/debug-liveedit-1.js b/test/mjsunit/debug-liveedit-1.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8ca01c0d551d309356427be191ebc70cf10d5dad |
--- /dev/null |
+++ b/test/mjsunit/debug-liveedit-1.js |
@@ -0,0 +1,20 @@ |
+// Flags: --expose-debug-as debug |
+// Get the Debug object exposed from the debug context global object. |
+ |
+Debug = debug.Debug |
+ |
+eval("var something1 = 25; " |
+ + " function ChooseAnimal() { return 'Cat'; } " |
+ + " ChooseAnimal.Helper = function() { return 'Help!'; }"); |
+ |
+assertEquals("Cat", ChooseAnimal()); |
+ |
+var script = Debug.findScript(ChooseAnimal); |
+ |
+var orig_animal = "Cat"; |
+var patch_pos = script.source.indexOf(orig_animal); |
+var new_animal_patch = "Cap' + 'y' + 'bara"; |
+ |
+Debug.change_script_live(script, patch_pos, orig_animal.length, new_animal_patch); |
+ |
+assertEquals("Capybara", ChooseAnimal()); |