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

Side by Side 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, 6 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-debug-as debug
5 // Flags: --harmony-async-await --allow-natives-syntax 6 // Flags: --harmony-async-await --allow-natives-syntax
6 7
8 var Debug = debug.Debug;
9
7 function assertEqualsAsync(expected, run, msg) { 10 function assertEqualsAsync(expected, run, msg) {
8 var actual; 11 var actual;
9 var hadValue = false; 12 var hadValue = false;
10 var hadError = false; 13 var hadError = false;
11 var promise = run(); 14 var promise = run();
12 15
13 if (typeof promise !== "object" || typeof promise.then !== "function") { 16 if (typeof promise !== "object" || typeof promise.then !== "function") {
14 throw new MjsUnitAssertionError( 17 throw new MjsUnitAssertionError(
15 "Expected " + run.toString() + 18 "Expected " + run.toString() +
16 " to return a Promise, but it returned " + PrettyPrint(promise)); 19 " to return a Promise, but it returned " + promise);
17 } 20 }
18 21
19 promise.then(function(value) { hadValue = true; actual = value; }, 22 promise.then(function(value) { hadValue = true; actual = value; },
20 function(error) { hadError = true; actual = error; }); 23 function(error) { hadError = true; actual = error; });
21 24
22 assertFalse(hadValue || hadError); 25 assertFalse(hadValue || hadError);
23 26
24 %RunMicrotasks(); 27 %RunMicrotasks();
25 28
26 if (hadError) throw actual; 29 if (hadError) throw actual;
27 30
28 assertTrue( 31 assertTrue(
29 hadValue, "Expected '" + run.toString() + "' to produce a value"); 32 hadValue, "Expected '" + run.toString() + "' to produce a value");
30 33
31 assertEquals(expected, actual, msg); 34 assertEquals(expected, actual, msg);
32 }; 35 }
33 36
34 class BaseClass { 37 var break_count = 0;
35 constructor(x) { 38 var exception = null;
36 this.name_ = x; 39
40 function listener(event, exec_state, event_data, data) {
41 if (event != Debug.DebugEvent.Break) return;
42 try {
43 break_count++;
44 var line = exec_state.frame(0).sourceLineText();
45 print(line);
46 assertTrue(line.indexOf(`B${break_count}`) > 0);
47 } catch (e) {
48 exception = e;
37 } 49 }
38 get name() { return this.name_; } 50 }
39 };
40
41 class DeferredSuperCall extends BaseClass {
42 constructor(x) {
43 return async() => super(x);
44 }
45 };
46
47 assertEqualsAsync(
48 "LexicalSuperCall",
49 () => new DeferredSuperCall("LexicalSuperCall")().then(x => x.name));
50 51
51 52
52 class DeferredSuperProperty extends BaseClass { 53 async function g() {
53 deferredName() { return async() => super.name; } 54 setbreaks();
54 }; 55 throw 1; // B1
56 }
55 57
56 assertEqualsAsync( 58 async function f() {
57 "LexicalSuperProperty", 59 try {
58 () => new DeferredSuperProperty("LexicalSuperProperty").deferredName()()); 60 await g();
61 } catch (e) {}
62 return 2; // B2
63 }
64
65 function setbreaks() {
66 Debug.setListener(listener);
67 Debug.setBreakPoint(g, 2);
68 Debug.setBreakPoint(f, 4);
69 }
70
71 f();
72
73 %RunMicrotasks();
74
75 assertEqualsAsync(2, async () => break_count);
76 assertEqualsAsync(null, async () => exception);
77
78 Debug.setListener(null);
OLDNEW
« 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