mirror of https://github.com/tc39/test262.git
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();
|
||||
|
||||
assert.throws(TypeError, r.evaluate(`
|
||||
assert.throws(TypeError, () => r.evaluate(`
|
||||
function fn() {}
|
||||
Object.defineProperty(fn, 'length', {
|
||||
get: () => {
|
||||
|
|
|
@ -23,7 +23,7 @@ assert.sameValue(
|
|||
|
||||
const r = new ShadowRealm();
|
||||
|
||||
assert.throws(TypeError, r.evaluate(`
|
||||
assert.throws(TypeError, () => r.evaluate(`
|
||||
function fn() {}
|
||||
Object.defineProperty(fn, 'name', {
|
||||
get: () => {
|
||||
|
|
|
@ -64,18 +64,20 @@ verifyProperty(wrapped, "name", {
|
|||
});
|
||||
|
||||
// The value of fn.name is not a string.
|
||||
wrapped = r.evaluate(`
|
||||
for (const name of [null, undefined, 0, '1n', false, NaN, Infinity, 'Symbol()', '[]', '{}']) {
|
||||
wrapped = r.evaluate(`
|
||||
function fn() {}
|
||||
Object.defineProperty(fn, 'name', {
|
||||
get: () => 1,
|
||||
value: ${String(name)},
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
fn;
|
||||
`);
|
||||
verifyProperty(wrapped, "name", {
|
||||
value: "",
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
verifyProperty(wrapped, "name", {
|
||||
value: "",
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue