mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 21:14:45 +02:00
Fix WrappedFunction throwing tests (#3396)
Also adds more non-string cases for copy name
This commit is contained in:
parent
b3774e9593
commit
281c781ee4
@ -23,7 +23,7 @@ assert.sameValue(
|
|||||||
|
|
||||||
const r = new ShadowRealm();
|
const r = new ShadowRealm();
|
||||||
|
|
||||||
assert.throws(TypeError, r.evaluate(`
|
assert.throws(TypeError, () => r.evaluate(`
|
||||||
function fn() {}
|
function fn() {}
|
||||||
Object.defineProperty(fn, 'length', {
|
Object.defineProperty(fn, 'length', {
|
||||||
get: () => {
|
get: () => {
|
||||||
|
@ -23,7 +23,7 @@ assert.sameValue(
|
|||||||
|
|
||||||
const r = new ShadowRealm();
|
const r = new ShadowRealm();
|
||||||
|
|
||||||
assert.throws(TypeError, r.evaluate(`
|
assert.throws(TypeError, () => r.evaluate(`
|
||||||
function fn() {}
|
function fn() {}
|
||||||
Object.defineProperty(fn, 'name', {
|
Object.defineProperty(fn, 'name', {
|
||||||
get: () => {
|
get: () => {
|
||||||
|
@ -64,10 +64,11 @@ verifyProperty(wrapped, "name", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// The value of fn.name is not a string.
|
// The value of fn.name is not a string.
|
||||||
|
for (const name of [null, undefined, 0, '1n', false, NaN, Infinity, 'Symbol()', '[]', '{}']) {
|
||||||
wrapped = r.evaluate(`
|
wrapped = r.evaluate(`
|
||||||
function fn() {}
|
function fn() {}
|
||||||
Object.defineProperty(fn, 'name', {
|
Object.defineProperty(fn, 'name', {
|
||||||
get: () => 1,
|
value: ${String(name)},
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
});
|
});
|
||||||
@ -79,3 +80,4 @@ verifyProperty(wrapped, "name", {
|
|||||||
writable: false,
|
writable: false,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user