Debian Codegraph @

js/src/tests/test262/built-ins/Promise/allSettled/reject-element-function-length.js

raw
1 // Copyright (C) 2019 Leo Balter. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-promise.allsettled-reject-element-functions
6 description: The `length` property of Promise.allSettled Reject Element functions
7 info: |
8 The length property of a Promise.allSettled Reject Element function is 1.
9
10 17 ECMAScript Standard Built-in Objects:
11 Unless otherwise specified, the length property of a built-in Function
12 object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
13 [[Configurable]]: true }.
14 includes: [propertyHelper.js]
15 features: [Promise.allSettled]
16 ---*/
17
18 var rejectElementFunction;
19 var thenable = {
20 then(_, reject) {
21 rejectElementFunction = reject;
22 }
23 };
24
25 function NotPromise(executor) {
26 executor(function() {}, function() {});
27 }
28 NotPromise.resolve = function(v) {
29 return v;
30 };
31 Promise.allSettled.call(NotPromise, [thenable]);
32
33 assert.sameValue(rejectElementFunction.length, 1);
34
35 verifyProperty(rejectElementFunction, 'length', {
36 value: 1,
37 enumerable: false,
38 writable: false,
39 configurable: true,
40 });
41
42 reportCompare(0, 0);