2014-10-23 19:58:31 +02:00
|
|
|
// Copyright 2014 Cubane Canada, Inc. All rights reserved.
|
|
|
|
// See LICENSE for details.
|
|
|
|
|
|
|
|
/*---
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2015-12-30 20:15:30 +01:00
|
|
|
[...]
|
|
|
|
5. Let rejectResult be Call(promiseCapability.[[Reject]], undefined, «r»).
|
|
|
|
[...]
|
|
|
|
|
|
|
|
25.4.1.3.1 Promise Reject Functions
|
|
|
|
[...]
|
|
|
|
6. Return RejectPromise(promise, reason).
|
|
|
|
es6id: 25.4.4.4
|
2014-10-23 19:58:31 +02:00
|
|
|
author: Sam Mikes
|
|
|
|
description: Promise.reject creates a new settled promise
|
2016-02-12 18:59:51 +01:00
|
|
|
flags: [async]
|
2014-10-23 19:58:31 +02:00
|
|
|
---*/
|
|
|
|
|
|
|
|
var p = Promise.reject(3);
|
|
|
|
|
2021-08-18 17:44:54 +02:00
|
|
|
assert(!!(p instanceof Promise), 'The value of !!(p instanceof Promise) is expected to be true');
|
2014-10-23 19:58:31 +02:00
|
|
|
|
2018-02-15 21:11:21 +01:00
|
|
|
p.then(function() {
|
2021-07-21 21:48:13 +02:00
|
|
|
throw new Test262Error("Promise should not be fulfilled.");
|
2021-08-18 17:44:54 +02:00
|
|
|
}, function(result) {
|
|
|
|
assert.sameValue(result, 3, 'The value of result is expected to be 3');
|
2014-10-23 19:58:31 +02:00
|
|
|
}).then($DONE, $DONE);
|