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

Side by Side Diff: test/debugger/debug/harmony/debug-async-break-on-stack.js

Issue 2621173002: Remove --harmony-async-await runtime flag (Closed)
Patch Set: Update test ref Created 3 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --harmony-async-await
6
7 var Debug = debug.Debug;
8
9 function assertEqualsAsync(expected, run, msg) {
10 var actual;
11 var hadValue = false;
12 var hadError = false;
13 var promise = run();
14
15 if (typeof promise !== "object" || typeof promise.then !== "function") {
16 throw new MjsUnitAssertionError(
17 "Expected " + run.toString() +
18 " to return a Promise, but it returned " + promise);
19 }
20
21 promise.then(function(value) { hadValue = true; actual = value; },
22 function(error) { hadError = true; actual = error; });
23
24 assertFalse(hadValue || hadError);
25
26 %RunMicrotasks();
27
28 if (hadError) throw actual;
29
30 assertTrue(
31 hadValue, "Expected '" + run.toString() + "' to produce a value");
32
33 assertEquals(expected, actual, msg);
34 }
35
36 var break_count = 0;
37 var exception = null;
38
39 function listener(event, exec_state, event_data, data) {
40 if (event != Debug.DebugEvent.Break) return;
41 try {
42 break_count++;
43 var line = exec_state.frame(0).sourceLineText();
44 print(line);
45 assertTrue(line.indexOf(`B${break_count}`) > 0);
46 } catch (e) {
47 exception = e;
48 }
49 }
50
51
52 async function g() {
53 setbreaks();
54 throw 1; // B1
55 }
56
57 async function f() {
58 try {
59 await g();
60 } catch (e) {}
61 return 2; // B2
62 }
63
64 function setbreaks() {
65 Debug.setListener(listener);
66 Debug.setBreakPoint(g, 2);
67 Debug.setBreakPoint(f, 4);
68 }
69
70 f();
71
72 %RunMicrotasks();
73
74 assertEqualsAsync(2, async () => break_count);
75 assertEqualsAsync(null, async () => exception);
76
77 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/debugger/debug/harmony/debug-async-break.js ('k') | test/debugger/debug/harmony/debug-async-liveedit.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698