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

Unified Diff: test/mjsunit/debug-set-variable-value.js

Issue 2493533003: [debug] Extend a test and fix some typos. (Closed)
Patch Set: Created 4 years, 1 month 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/debug/debug.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-set-variable-value.js
diff --git a/test/mjsunit/debug-set-variable-value.js b/test/mjsunit/debug-set-variable-value.js
index 65434289d002b2ce023813a6ca1e936026217407..fc4438c6f6a1c6936708b8c0f8a206112ebde46f 100644
--- a/test/mjsunit/debug-set-variable-value.js
+++ b/test/mjsunit/debug-set-variable-value.js
@@ -63,7 +63,7 @@ function RunPauseTest(scope_number, expected_old_result, variable_name,
// Add the debug event listener.
Debug.setListener(listener);
- var actual_new_value;
+ var actual_new_result;
try {
actual_new_result = fun();
} finally {
@@ -78,7 +78,7 @@ function RunPauseTest(scope_number, expected_old_result, variable_name,
assertEquals(expected_new_result, actual_new_result);
}
-// Accepts a closure 'fun' that returns a variable from it's outer scope.
+// Accepts a closure 'fun' that returns a variable from its outer scope.
// The test changes the value of variable via the handle to function and checks
// that the return value changed accordingly.
function RunClosureTest(scope_number, expected_old_result, variable_name,
@@ -307,3 +307,23 @@ assertSame(Number, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(Number).handle()}));
assertSame(RunClosureTest, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(RunClosureTest).handle()}));
+
+
+// Test script-scope variable.
+let abc = 12;
+{
+ function listener(event, exec_state) {
+ if (event == Debug.DebugEvent.Break) {
jgruber 2016/11/10 16:30:05 FYI: Exceptions thrown in debug listeners cause a
+ let scope_count = exec_state.frame().scopeCount();
+ let script_scope = exec_state.frame().scope(scope_count - 2);
+ assertTrue(script_scope.isScope());
+ assertEquals(debug.ScopeType.Script, script_scope.scopeType());
+ script_scope.setVariableValue('abc', 42);
+ }
+ }
+
+ Debug.setListener(listener);
+ assertEquals(12, abc);
+ debugger;
+ assertEquals(42, abc);
+}
« no previous file with comments | « src/debug/debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698