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

Unified Diff: test/debugger/regress/regress-6085.js

Issue 2744213003: [debugger] fix switch block source positions. (Closed)
Patch Set: address comment Created 3 years, 9 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/parsing/parser-base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/debugger/regress/regress-6085.js
diff --git a/test/debugger/regress/regress-6085.js b/test/debugger/regress/regress-6085.js
new file mode 100644
index 0000000000000000000000000000000000000000..ef251516459e1f6863a34ac8dc714cae1a0e2553
--- /dev/null
+++ b/test/debugger/regress/regress-6085.js
@@ -0,0 +1,49 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function* serialize() {
+ debugger;
+ switch (0) {
+ case 0:
+ let x = 1;
+ return x; // Check scopes
+ }
+}
+
+let exception = null;
+let step_count = 0;
+let scopes_checked = false;
+
+function listener(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Break) return;
+ try {
+ if (exec_state.frame().sourceLineText().includes("Check scopes")) {
+ let expected = [ debug.ScopeType.Block,
+ debug.ScopeType.Local,
+ debug.ScopeType.Script,
+ debug.ScopeType.Global ];
+ for (let i = 0; i < exec_state.frame().scopeCount(); i++) {
+ assertEquals(expected[i], exec_state.frame().scope(i).scopeType());
+ }
+ scopes_checked = true;
+ }
+ if (step_count++ < 3) exec_state.prepareStep(Debug.StepAction.StepNext);
+ } catch (e) {
+ exception = e;
+ print(e, e.stack);
+ }
+}
+
+
+
+let Debug = debug.Debug;
+Debug.setListener(listener);
+
+let gen = serialize();
+gen.next();
+
+Debug.setListener(null);
+assertNull(exception);
+assertEquals(4, step_count);
+assertTrue(scopes_checked);
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698