test262/test/built-ins/Promise/allSettled/reject-element-function-nam...

33 lines
960 B
JavaScript

// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-promise.allsettled-reject-element-functions
description: The `name` property of Promise.allSettled Reject Element functions
info: |
A promise resolve function is an anonymous built-in function.
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
features: [Promise.allSettled]
---*/
var rejectElementFunction;
var thenable = {
then(_, reject) {
rejectElementFunction = reject;
}
};
function NotPromise(executor) {
executor(function() {}, function() {});
}
NotPromise.resolve = function(v) {
return v;
};
Promise.allSettled.call(NotPromise, [thenable]);
assert.sameValue(Object.prototype.hasOwnProperty.call(rejectElementFunction, 'name'), false);