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

Side by Side Diff: test/mjsunit/harmony/async-arrow-lexical-super.js

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: fix some nits 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 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 --allow-natives-syntax
6
7 function assertEqualsAsync(expected, run, msg) {
8 var actual;
9 var hadValue = false;
10 var hadError = false;
11 var promise = run();
12
13 if (typeof promise !== "object" || typeof promise.then !== "function") {
14 throw new MjsUnitAssertionError(
15 "Expected " + run.toString() +
16 " to return a Promise, but it returned " + PrettyPrint(promise));
17 }
18
19 promise.then(function(value) { hadValue = true; actual = value; },
20 function(error) { hadError = true; actual = error; });
21
22 assertFalse(hadValue || hadError);
23
24 %RunMicrotasks();
25
26 if (hadError) throw actual;
27
28 assertTrue(
29 hadValue, "Expected '" + run.toString() + "' to produce a value");
30
31 assertEquals(expected, actual, msg);
32 };
33
34 class BaseClass {
35 constructor(x) {
36 this.name_ = x;
37 }
38 get name() { return this.name_; }
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
52 class DeferredSuperProperty extends BaseClass {
53 deferredName() { return async() => super.name; }
54 };
55
56 assertEqualsAsync(
57 "LexicalSuperProperty",
58 () => new DeferredSuperProperty("LexicalSuperProperty").deferredName()());
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/async-arrow-lexical-new.target.js ('k') | test/mjsunit/harmony/async-arrow-lexical-this.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698