Debian Codegraph @

js/src/tests/test262/built-ins/Promise/reject/S25.4.4.4_A2.1_T1.js

raw
1 // |reftest| async
2 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
3 // See LICENSE for details.
4
5 /*---
6 info: |
7 [...]
8 5. Let rejectResult be Call(promiseCapability.[[Reject]], undefined, «r»).
9 [...]
10
11 25.4.1.3.1 Promise Reject Functions
12 [...]
13 6. Return RejectPromise(promise, reason).
14 es6id: 25.4.4.4
15 author: Sam Mikes
16 description: Promise.reject creates a new settled promise
17 flags: [async]
18 ---*/
19
20 var p = Promise.reject(3);
21
22 assert(!!(p instanceof Promise), 'The value of !!(p instanceof Promise) is expected to be true');
23
24 p.then(function() {
25 throw new Test262Error("Promise should not be fulfilled.");
26 }, function(result) {
27 assert.sameValue(result, 3, 'The value of result is expected to be 3');
28 }).then($DONE, $DONE);