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

Unified Diff: test/debugger/debug/es6/debug-stepnext-generators.js

Issue 2519853002: [debugger] step-next across yield should not leave the generator. (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 | « test/debugger/debug/es6/debug-stepin-generators.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/debugger/debug/es6/debug-stepnext-generators.js
diff --git a/test/debugger/debug/es6/debug-stepnext-generators.js b/test/debugger/debug/es6/debug-stepnext-generators.js
new file mode 100644
index 0000000000000000000000000000000000000000..966030076e7f707a7b8c2189d4c86a10d7d2f6eb
--- /dev/null
+++ b/test/debugger/debug/es6/debug-stepnext-generators.js
@@ -0,0 +1,48 @@
+// Copyright 2016 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.
+
+Debug = debug.Debug
+var exception = null;
+var breaks = 0;
+
+function listener(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Break) return;
+ try {
+ var source = exec_state.frame(0).sourceLineText();
+ assertTrue(RegExp(`B${breaks++}`).test(source));
+ if (/stop/.test(source)) return;
+ if (/step out/.test(source)) {
+ exec_state.prepareStep(Debug.StepAction.StepOut);
+ } else if (/step in/.test(source)) {
+ exec_state.prepareStep(Debug.StepAction.StepIn);
+ } else {
+ exec_state.prepareStep(Debug.StepAction.StepNext);
+ }
+ } catch (e) {
+ print(e, e.stack);
+ exception = e;
+ }
+}
+
+Debug.setListener(listener);
+
+function * g() {
+ debugger; // B0
+ yield 1; // B1
+ yield 2; // B2 step out
+ yield 3; // B5
+ yield 4; // B6 step out
+ return 2 * (yield 5);
+}
+
+var i = g();
+assertEquals(1, i.next().value);
+assertEquals(2, i.next().value); // B3
+assertEquals(3, i.next().value); // B4 step in
+assertEquals(4, i.next().value); // B7
+assertEquals(5, i.next().value); // B8
+assertEquals(6, i.next(3).value); // B9 stop
+
+assertNull(exception);
+assertEquals(10, breaks);
« no previous file with comments | « test/debugger/debug/es6/debug-stepin-generators.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698