OLD | NEW |
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: --harmony-async-await --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 function assertEqualsAsync(expected, run, msg) { | 7 function assertEqualsAsync(expected, run, msg) { |
8 var actual; | 8 var actual; |
9 var hadValue = false; | 9 var hadValue = false; |
10 var hadError = false; | 10 var hadError = false; |
11 var promise = run(); | 11 var promise = run(); |
12 | 12 |
13 if (typeof promise !== "object" || typeof promise.then !== "function") { | 13 if (typeof promise !== "object" || typeof promise.then !== "function") { |
14 throw new MjsUnitAssertionError( | 14 throw new MjsUnitAssertionError( |
15 "Expected " + run.toString() + | 15 "Expected " + run.toString() + |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 assertEqualsAsync( | 92 assertEqualsAsync( |
93 "foo", | 93 "foo", |
94 test(function testThenOnReturnedPromise() { | 94 test(function testThenOnReturnedPromise() { |
95 return asyncFn().then(x => (log.push("Then: " + x), x)); | 95 return asyncFn().then(x => (log.push("Then: " + x), x)); |
96 }), | 96 }), |
97 "should call Promise[@@Species] after non-internal Then"); | 97 "should call Promise[@@Species] after non-internal Then"); |
98 assertEquals([ | 98 assertEquals([ |
99 "@@Species: [@testThenOnReturnedPromise > Promise.then > FakePromise]", | 99 "@@Species: [@testThenOnReturnedPromise > Promise.then > FakePromise]", |
100 "Then: foo" | 100 "Then: foo" |
101 ], log); | 101 ], log); |
OLD | NEW |