Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/all/S25.4.4.1_A8.2_T1.js

raw
1 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
2 // See LICENSE for details.
3
4 /*---
5 info: |
6 Promise.all with 2-element array
7 es6id: S25.4.4.1_A8.1_T1
8 author: Sam Mikes
9 description: Promise.all() rejects when a promise in its array rejects
10 flags: [async]
11 ---*/
12
13 var rejectP1,
14 p1 = new Promise(function(resolve, reject) {
15 rejectP1 = reject;
16 }),
17 p2 = Promise.resolve(2);
18
19 Promise.all([p1, p2]).then(function(resolve) {
20 $ERROR("Did not expect promise to be fulfilled.");
21 }, function(rejected) {
22 if (rejected !== 1) {
23 $ERROR("Expected promise to be rejected with 1, actually " + rejected);
24 }
25 }).then($DONE, $DONE);
26
27 rejectP1(1);