Skip to content
Snippets Groups Projects
Commit a5bf1948 authored by Mike Pennisi's avatar Mike Pennisi
Browse files

Extend coverage for PerformPromiseThen

parent 8e069e91
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 25.4.5.3
description: PerformPromiseThen on a pending promise that is later fulfilled
info: >
7. Return PerformPromiseThen(promise, onFulfilled, onRejected,
resultCapability).
25.4.5.3.1 PerformPromiseThen
[...]
7. If the value of promise's [[PromiseState]] internal slot is "pending",
a. Append fulfillReaction as the last element of the List that is the
value of promise's [[PromiseFulfillReactions]] internal slot.
b. Append rejectReaction as the last element of the List that is the
value of promise's [[PromiseRejectReactions]] internal slot.
[...]
---*/
var value = {};
var resolve;
var p = new Promise(function(_resolve) { resolve = _resolve; });
p.then(function(x) {
if (x !== value) {
$DONE('The `onFulfilled` handler should be invoked with the promise result.');
return;
}
$DONE();
}, function() {
$DONE('The `onRejected` handler should not be invoked.');
});
resolve(value);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 25.4.5.3
description: PerformPromiseThen on a pending promise that is later rejected
info: >
7. Return PerformPromiseThen(promise, onFulfilled, onRejected,
resultCapability).
25.4.5.3.1 PerformPromiseThen
[...]
7. If the value of promise's [[PromiseState]] internal slot is "pending",
a. Append fulfillReaction as the last element of the List that is the
value of promise's [[PromiseFulfillReactions]] internal slot.
b. Append rejectReaction as the last element of the List that is the
value of promise's [[PromiseRejectReactions]] internal slot.
[...]
---*/
var value = {};
var reject;
var p = new Promise(function(_, _reject) { reject = _reject; });
p.then(function() {
$DONE('The `onFulfilled` handler should not be invoked.');
}, function(x) {
if (x !== value) {
$DONE('The `onRejected` handler should be invoked with the promise result.');
return;
}
$DONE();
});
reject(value);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment