diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-04-27 00:31:47 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-04-27 00:31:47 -0700 |
commit | 24931f840544c9970203660121a1ec4606bdd4f1 (patch) | |
tree | f22539325eb06fc50879d9d4f327cf6c83645891 /deps/v8/test/mjsunit/debug-liveedit-newsource.js | |
parent | 2374e557e30fab5c357d3f03716ca3b83131c3c0 (diff) | |
download | node-new-24931f840544c9970203660121a1ec4606bdd4f1.tar.gz |
Upgrade V8 to 2.2.5
Diffstat (limited to 'deps/v8/test/mjsunit/debug-liveedit-newsource.js')
-rw-r--r-- | deps/v8/test/mjsunit/debug-liveedit-newsource.js | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/deps/v8/test/mjsunit/debug-liveedit-newsource.js b/deps/v8/test/mjsunit/debug-liveedit-newsource.js index f07d714948..db256a48fe 100644 --- a/deps/v8/test/mjsunit/debug-liveedit-newsource.js +++ b/deps/v8/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")); |