Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1049)

Unified Diff: test/mjsunit/debug-liveedit-newsource.js

Issue 1672006: Support multi-chunk differences (Closed)
Patch Set: merge Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/debug-liveedit-newsource.js
diff --git a/test/mjsunit/debug-liveedit-newsource.js b/test/mjsunit/debug-liveedit-newsource.js
index f07d714948e40da9dd51fdb08db2575a2a9018fe..db256a48fe41a72a30d3ce9084d3734481d93073 100644
--- a/test/mjsunit/debug-liveedit-newsource.js
+++ b/test/mjsunit/debug-liveedit-newsource.js
@@ -30,18 +30,39 @@
Debug = debug.Debug
-eval("var something1 = 25; "
- + " function ChooseAnimal() { return 'Cat'; } "
- + " ChooseAnimal.Helper = function() { return 'Help!'; }");
+eval("var something1 = 25; \n"
+ + "var something2 = 2010; \n"
+ + "function ChooseAnimal() {\n"
+ + " return 'Cat';\n"
+ + "} \n"
+ + "function ChooseFurniture() {\n"
+ + " return 'Table';\n"
+ + "} \n"
+ + "function ChooseNumber() { return 17; } \n"
+ + "ChooseAnimal.Factory = function Factory() {\n"
+ + " return function FactoryImpl(name) {\n"
+ + " return 'Help ' + name;\n"
+ + " }\n"
+ + "}\n");
assertEquals("Cat", ChooseAnimal());
+assertEquals(25, something1);
var script = Debug.findScript(ChooseAnimal);
var new_source = script.source.replace("Cat", "Cap' + 'yb' + 'ara");
+var new_source = new_source.replace("25", "26");
+var new_source = new_source.replace("Help", "Hello");
+var new_source = new_source.replace("17", "18");
print("new source: " + new_source);
var change_log = new Array();
Debug.LiveEdit.SetScriptSource(script, new_source, change_log);
+print("Change log: " + JSON.stringify(change_log) + "\n");
assertEquals("Capybara", ChooseAnimal());
+// Global variable do not get changed (without restarting script).
+assertEquals(25, something1);
+// Function is oneliner, so currently it is treated as damaged and not patched.
+assertEquals(17, ChooseNumber());
+assertEquals("Hello Peter", ChooseAnimal.Factory()("Peter"));
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698