mirror of https://github.com/tc39/test262.git
Set function `length` and `name` in `CreateBuiltinFunction`
This commit is contained in:
parent
11624af8d0
commit
8f904d8cc8
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Function constructor property order
|
||||
info: |
|
||||
Set order: "length", "name", ...
|
||||
---*/
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(Function);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Function constructor property order
|
||||
info: |
|
||||
Set order: "length", "name", ...
|
||||
---*/
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(Function.prototype);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Object constructor property order
|
||||
info: |
|
||||
Set order: "length", "name", ...
|
||||
---*/
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(Object);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Promise.all resolve element function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
---*/
|
||||
|
||||
var resolveElementFunction;
|
||||
var thenable = {
|
||||
then: function(fulfill) {
|
||||
resolveElementFunction = fulfill;
|
||||
}
|
||||
};
|
||||
|
||||
function NotPromise(executor) {
|
||||
executor(function() {}, function() {});
|
||||
}
|
||||
NotPromise.resolve = function(v) {
|
||||
return v;
|
||||
};
|
||||
Promise.all.call(NotPromise, [thenable]);
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(resolveElementFunction);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Promise.allSettled reject element function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
features: [Promise.allSettled]
|
||||
---*/
|
||||
|
||||
var rejectElementFunction;
|
||||
var thenable = {
|
||||
then: function(_, reject) {
|
||||
rejectElementFunction = reject;
|
||||
}
|
||||
};
|
||||
|
||||
function NotPromise(executor) {
|
||||
executor(function() {}, function() {});
|
||||
}
|
||||
NotPromise.resolve = function(v) {
|
||||
return v;
|
||||
};
|
||||
Promise.allSettled.call(NotPromise, [thenable]);
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(rejectElementFunction);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Promise.allSettled resolve element function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
features: [Promise.allSettled]
|
||||
---*/
|
||||
|
||||
var resolveElementFunction;
|
||||
var thenable = {
|
||||
then: function(fulfill) {
|
||||
resolveElementFunction = fulfill;
|
||||
}
|
||||
};
|
||||
|
||||
function NotPromise(executor) {
|
||||
executor(function() {}, function() {});
|
||||
}
|
||||
NotPromise.resolve = function(v) {
|
||||
return v;
|
||||
};
|
||||
Promise.allSettled.call(NotPromise, [thenable]);
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(resolveElementFunction);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Promise.any resolve element function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
features: [Promise.any]
|
||||
---*/
|
||||
|
||||
var rejectElementFunction;
|
||||
var thenable = {
|
||||
then: function(_, reject) {
|
||||
rejectElementFunction = reject;
|
||||
}
|
||||
};
|
||||
|
||||
function NotPromise(executor) {
|
||||
executor(function() {}, function() {});
|
||||
}
|
||||
NotPromise.resolve = function(v) {
|
||||
return v;
|
||||
};
|
||||
Promise.any.call(NotPromise, [thenable]);
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(rejectElementFunction);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Promise executor function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
---*/
|
||||
|
||||
var executorFunction;
|
||||
|
||||
function NotPromise(executor) {
|
||||
executorFunction = executor;
|
||||
executor(function() {}, function() {});
|
||||
}
|
||||
Promise.resolve.call(NotPromise);
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(executorFunction);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Promise constructor property order
|
||||
info: |
|
||||
Set order: "length", "name", ...
|
||||
---*/
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(Promise);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Promise reject function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
---*/
|
||||
|
||||
var rejectFunction;
|
||||
new Promise(function(_, reject) {
|
||||
rejectFunction = reject;
|
||||
});
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(rejectFunction);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Promise resolve function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
---*/
|
||||
|
||||
var resolveFunction;
|
||||
new Promise(function(resolve) {
|
||||
resolveFunction = resolve;
|
||||
});
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(resolveFunction);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Proxy constructor property order
|
||||
info: |
|
||||
Set order: "length", "name", ...
|
||||
features: [Proxy]
|
||||
---*/
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(Proxy);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Proxy revocation function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
---*/
|
||||
|
||||
var revocationFunction = Proxy.revocable({}, {}).revoke;
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(revocationFunction);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: "%ThrowTypeError% function property order"
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
---*/
|
||||
|
||||
var ThrowTypeError = Object.getOwnPropertyDescriptor(function() {
|
||||
"use strict";
|
||||
return arguments;
|
||||
}(), "callee").get;
|
||||
|
||||
var propNames = Object.getOwnPropertyNames(ThrowTypeError);
|
||||
var lengthIndex = propNames.indexOf("length");
|
||||
var nameIndex = propNames.indexOf("name");
|
||||
|
||||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
|
||||
"The `length` property comes before the `name` property on built-in functions");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: Collator bound compare function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
includes: [compareArray.js]
|
||||
---*/
|
||||
|
||||
var compareFn = new Intl.Collator().compare;
|
||||
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(compareFn),
|
||||
['length', 'name']
|
||||
);
|
16
test/intl402/DateTimeFormat/prototype/format/format-function-property-order.js
vendored
Normal file
16
test/intl402/DateTimeFormat/prototype/format/format-function-property-order.js
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: DateTimeFormat bound format function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
includes: [compareArray.js]
|
||||
---*/
|
||||
|
||||
var formatFn = new Intl.DateTimeFormat().format;
|
||||
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(formatFn),
|
||||
['length', 'name']
|
||||
);
|
16
test/intl402/NumberFormat/prototype/format/format-function-property-order.js
vendored
Normal file
16
test/intl402/NumberFormat/prototype/format/format-function-property-order.js
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2020 ExE Boss. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-createbuiltinfunction
|
||||
description: NumberFormat bound format function property order
|
||||
info: |
|
||||
Set order: "length", "name"
|
||||
includes: [compareArray.js]
|
||||
---*/
|
||||
|
||||
var formatFn = new Intl.NumberFormat().format;
|
||||
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(formatFn),
|
||||
['length', 'name']
|
||||
);
|
Loading…
Reference in New Issue