Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/all/invoke-resolve-error-reject.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Promise rejection in response to error
6 esid: sec-promise.all
7 es6id: 25.4.4.1
8 info: |
9 11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
10 12. If result is an abrupt completion,
11 a. If iteratorRecord.[[done]] is false, let result be
12 IteratorClose(iterator, result).
13 b. IfAbruptRejectPromise(result, promiseCapability).
14
15 [...]
16
17 25.4.4.1.1 Runtime Semantics: PerformPromiseAll
18
19 [...]
20 6. Repeat
21 [...]
22 i. Let nextPromise be Invoke(constructor, "resolve", «nextValue»).
23 j. ReturnIfAbrupt(nextPromise ).
24 flags: [async]
25 ---*/
26
27 var thrown = new Test262Error();
28 Promise.resolve = function() {
29 throw thrown;
30 };
31
32 Promise.all([1])
33 .then(function() {
34 $ERROR('The promise should not be fulfilled.');
35 }, function(reason) {
36 if (reason !== thrown) {
37 $ERROR('The promise should be rejected with the thrown error object');
38 }
39 }).then($DONE, $DONE);