Debian Codegraph @

js/src/tests/test262/built-ins/Promise/resolve/S25.4.4.5_A2.2_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.2_T1
7 author: Sam Mikes
8 description: Promise.resolve passes through an unsettled promise w/ same Constructor
9 flags: [async]
10 ---*/
11
12 var resolveP1,
13 p1 = new Promise(function(resolve) {
14 resolveP1 = resolve;
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(result) {
22 assert.sameValue(result, arg, 'The value of result is expected to equal the value of arg');
23 }).then($DONE, $DONE);
24
25 resolveP1(arg);