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

Unified Diff: test/mjsunit/harmony/debug-async-break-on-stack.js

Issue 1996943002: [esnext] Fix various callsites to use is_resumable, not is_generator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: don't pass unneeded zero Created 4 years, 7 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 | « test/mjsunit/harmony/debug-async-break.js ('k') | test/webkit/class-syntax-extends.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/debug-async-break-on-stack.js
diff --git a/test/mjsunit/harmony/async-arrow-lexical-super.js b/test/mjsunit/harmony/debug-async-break-on-stack.js
similarity index 50%
copy from test/mjsunit/harmony/async-arrow-lexical-super.js
copy to test/mjsunit/harmony/debug-async-break-on-stack.js
index 78f5d555b607d2dc3ad5e9245330b775f5d9b006..d3d9d8bef63809fb880f98f478613b0f40c22b20 100644
--- a/test/mjsunit/harmony/async-arrow-lexical-super.js
+++ b/test/mjsunit/harmony/debug-async-break-on-stack.js
@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Flags: --expose-debug-as debug
// Flags: --harmony-async-await --allow-natives-syntax
+var Debug = debug.Debug;
+
function assertEqualsAsync(expected, run, msg) {
var actual;
var hadValue = false;
@@ -13,7 +16,7 @@ function assertEqualsAsync(expected, run, msg) {
if (typeof promise !== "object" || typeof promise.then !== "function") {
throw new MjsUnitAssertionError(
"Expected " + run.toString() +
- " to return a Promise, but it returned " + PrettyPrint(promise));
+ " to return a Promise, but it returned " + promise);
}
promise.then(function(value) { hadValue = true; actual = value; },
@@ -29,30 +32,47 @@ function assertEqualsAsync(expected, run, msg) {
hadValue, "Expected '" + run.toString() + "' to produce a value");
assertEquals(expected, actual, msg);
-};
+}
-class BaseClass {
- constructor(x) {
- this.name_ = x;
- }
- get name() { return this.name_; }
-};
+var break_count = 0;
+var exception = null;
-class DeferredSuperCall extends BaseClass {
- constructor(x) {
- return async() => super(x);
+function listener(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Break) return;
+ try {
+ break_count++;
+ var line = exec_state.frame(0).sourceLineText();
+ print(line);
+ assertTrue(line.indexOf(`B${break_count}`) > 0);
+ } catch (e) {
+ exception = e;
}
-};
+}
+
+
+async function g() {
+ setbreaks();
+ throw 1; // B1
+}
+
+async function f() {
+ try {
+ await g();
+ } catch (e) {}
+ return 2; // B2
+}
+
+function setbreaks() {
+ Debug.setListener(listener);
+ Debug.setBreakPoint(g, 2);
+ Debug.setBreakPoint(f, 4);
+}
-assertEqualsAsync(
- "LexicalSuperCall",
- () => new DeferredSuperCall("LexicalSuperCall")().then(x => x.name));
+f();
+%RunMicrotasks();
-class DeferredSuperProperty extends BaseClass {
- deferredName() { return async() => super.name; }
-};
+assertEqualsAsync(2, async () => break_count);
+assertEqualsAsync(null, async () => exception);
-assertEqualsAsync(
- "LexicalSuperProperty",
- () => new DeferredSuperProperty("LexicalSuperProperty").deferredName()());
+Debug.setListener(null);
« no previous file with comments | « test/mjsunit/harmony/debug-async-break.js ('k') | test/webkit/class-syntax-extends.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698