Debian Codegraph @

js/src/tests/test262/built-ins/Promise/resolve/S25.4.4.5_A2.3_T1.js

raw
1 // |reftest| async
2 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
3 // See LICENSE for details.
4
5 /*---
6 es6id: S25.4.4.5_A2.3_T1
7 author: Sam Mikes
8 description: Promise.resolve passes through an unsettled promise w/ same Constructor
9 flags: [async]
10 ---*/
11
12 var rejectP1,
13 p1 = new Promise(function(resolve, reject) {
14 rejectP1 = reject;
15 }),
16 p2 = Promise.resolve(p1),
17 arg = {};
18
19 assert.sameValue(p1, p2, 'The value of p1 is expected to equal the value of p2');
20
21 p2.then(function() {
22 throw new Test262Error("Expected p2 to be rejected, not fulfilled.");
23 }, function(result) {
24 assert.sameValue(result, arg, 'The value of result is expected to equal the value of arg');
25 }).then($DONE, $DONE);
26
27 rejectP1(arg);