mirror of https://github.com/tc39/test262.git
Remove or relocate misleading tests
These tests were designed to test the built-in "Promise.race Resolve Element function," but ECMA262 does not describe such a function. Contrary to the test's description, the function under test is created by the InstantiateArrowFunctionExpression abstract operation. The following tests verify most of the details directly (only the function object's extensibility was not already tested by the existing tests): - test/language/expressions/arrow-function/name.js - test/language/expressions/arrow-function/throw-new.js - test/language/expressions/arrow-function/prototype-rules.js The definition of the built-in resolving functions is closely related, but Test262 already includes tests for the corresponding concerns: - test/built-ins/Promise/resolve-function-extensible.js - test/built-ins/Promise/resolve-function-name.js - test/built-ins/Promise/resolve-function-nonconstructor.js - test/built-ins/Promise/resolve-function-prototype.js Remove the tests and introduce one additional test to preserve coverage while improving discoverability.
This commit is contained in:
parent
9da1d6119c
commit
9b622bf093
|
@ -1,28 +0,0 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race-resolve-element-functions
|
||||
description: The [[Extensible]] slot of Promise.race Resolve Element functions
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
Unless specified otherwise, the [[Extensible]] internal slot
|
||||
of a built-in object initially has the value true.
|
||||
---*/
|
||||
|
||||
let resolveElementFunction;
|
||||
let thenable = {
|
||||
then(fulfill) {
|
||||
resolveElementFunction = fulfill;
|
||||
}
|
||||
};
|
||||
|
||||
function NotPromise(executor) {
|
||||
executor(() => {}, () => {});
|
||||
}
|
||||
NotPromise.resolve = function(v) {
|
||||
return v;
|
||||
};
|
||||
Promise.race.call(NotPromise, [thenable]);
|
||||
|
||||
assert(Object.isExtensible(resolveElementFunction));
|
|
@ -1,38 +0,0 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race-resolve-element-functions
|
||||
description: The `name` property of Promise.race Resolve 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, has a `name`
|
||||
property whose value is a String. Functions that are identified as
|
||||
anonymous functions use the empty string as the value of the `name`
|
||||
property.
|
||||
Unless otherwise specified, the `name` property of a built-in function
|
||||
object has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*,
|
||||
[[Configurable]]: *true* }.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
let resolveElementFunction;
|
||||
let thenable = {
|
||||
then(fulfill) {
|
||||
resolveElementFunction = fulfill;
|
||||
}
|
||||
};
|
||||
|
||||
function NotPromise(executor) {
|
||||
executor(() => {}, () => {});
|
||||
}
|
||||
NotPromise.resolve = function(v) {
|
||||
return v;
|
||||
};
|
||||
Promise.race.call(NotPromise, [thenable]);
|
||||
|
||||
verifyProperty(resolveElementFunction, "name", {
|
||||
value: "", writable: false, enumerable: false, configurable: true
|
||||
});
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race-resolve-element-functions
|
||||
description: Promise.race Resolve Element functions are not constructors
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
Built-in function objects that are not identified as constructors do not
|
||||
implement the [[Construct]] internal method unless otherwise specified
|
||||
in the description of a particular function.
|
||||
---*/
|
||||
|
||||
let resolveElementFunction;
|
||||
let thenable = {
|
||||
then(fulfill) {
|
||||
resolveElementFunction = fulfill;
|
||||
}
|
||||
};
|
||||
|
||||
function NotPromise(executor) {
|
||||
executor(() => {}, () => {});
|
||||
}
|
||||
NotPromise.resolve = function(v) {
|
||||
return v;
|
||||
};
|
||||
Promise.race.call(NotPromise, [thenable]);
|
||||
|
||||
assert.sameValue(Object.prototype.hasOwnProperty.call(resolveElementFunction, 'prototype'), false);
|
||||
assert.throws(TypeError, () => {
|
||||
new resolveElementFunction();
|
||||
});
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race-resolve-element-functions
|
||||
description: The [[Prototype]] of Promise.race Resolve Element functions
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
Unless otherwise specified every built-in function and every built-in
|
||||
constructor has the Function prototype object, which is the initial
|
||||
value of the expression Function.prototype (19.2.3), as the value of
|
||||
its [[Prototype]] internal slot.
|
||||
---*/
|
||||
|
||||
let resolveElementFunction;
|
||||
let thenable = {
|
||||
then(fulfill) {
|
||||
resolveElementFunction = fulfill;
|
||||
}
|
||||
};
|
||||
|
||||
function NotPromise(executor) {
|
||||
executor(() => {}, () => {});
|
||||
}
|
||||
NotPromise.resolve = function(v) {
|
||||
return v;
|
||||
};
|
||||
Promise.race.call(NotPromise, [thenable]);
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(resolveElementFunction), Function.prototype);
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
description: The [[Extensible]] slot of arrow functions
|
||||
info: |
|
||||
15.3.4 Runtime Semantics: InstantiateArrowFunctionExpression
|
||||
[...]
|
||||
4. Let closure be OrdinaryFunctionCreate(%Function.prototype%, sourceText,
|
||||
ArrowParameters, ConciseBody, lexical-this, scope).
|
||||
|
||||
10.2.3 OrdinaryFunctionCreate ( functionPrototype, sourceText, ParameterList, Body, thisMode, Scope )
|
||||
[...]
|
||||
3. Let F be ! OrdinaryObjectCreate(functionPrototype, internalSlotsList).
|
||||
|
||||
10.1.12 OrdinaryObjectCreate ( proto [ , additionalInternalSlotsList ] )
|
||||
1. Let internalSlotsList be « [[Prototype]], [[Extensible]] ».
|
||||
2. If additionalInternalSlotsList is present, append each of its elements
|
||||
to internalSlotsList.
|
||||
3. Let O be ! MakeBasicObject(internalSlotsList).
|
||||
|
||||
7.3.1 MakeBasicObject ( internalSlotsList )
|
||||
[...]
|
||||
6. If internalSlotsList contains [[Extensible]], set obj.[[Extensible]] to
|
||||
true.
|
||||
---*/
|
||||
|
||||
assert(Object.isExtensible(() => {}));
|
Loading…
Reference in New Issue