mirror of
https://github.com/tc39/test262.git
synced 2025-07-24 14:35:30 +02:00
fixup! Add tests for MethodDefinition forms new to ES6
Avoid extending builtin prototype and consistently define a shadowing property on the object instance to help recognize a possible implementation bug.
This commit is contained in:
parent
31bdf48bec
commit
30a4a5da7d
@ -10,18 +10,14 @@ author: Sam Mikes
|
||||
description: GeneratorMethod body uses SuperProperty (allowed)
|
||||
---*/
|
||||
|
||||
var value = {};
|
||||
var obj;
|
||||
|
||||
try {
|
||||
Object.prototype.Test262Attr = value;
|
||||
obj = {
|
||||
*foo() {
|
||||
return super.Test262Attr;
|
||||
}
|
||||
};
|
||||
var obj = {
|
||||
*foo() {
|
||||
return super.toString;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(obj.foo().next().value, value);
|
||||
} finally {
|
||||
delete Object.prototype.Test262Attr;
|
||||
}
|
||||
obj.toString = null;
|
||||
|
||||
assert.sameValue(obj.foo().next().value, Object.prototype.toString);
|
||||
|
@ -11,18 +11,12 @@ description: GeneratorMethod uses SuperProperty (allowed)
|
||||
features: [ default-arg, generator, super ]
|
||||
---*/
|
||||
|
||||
var value = {};
|
||||
var obj;
|
||||
var obj = {
|
||||
*foo(a = super.toString) {
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
Object.prototype.Test262Attr = value;
|
||||
obj = {
|
||||
*foo(a = super.Test262Attr) {
|
||||
return a;
|
||||
}
|
||||
};
|
||||
obj.toString = null;
|
||||
|
||||
assert.sameValue(obj.foo().next().value, value);
|
||||
} finally {
|
||||
delete Object.prototype.Test262Attr;
|
||||
}
|
||||
assert.sameValue(obj.foo().next().value, Object.prototype.toString);
|
||||
|
@ -8,18 +8,12 @@ es6id: 14.3.8
|
||||
features: [super]
|
||||
---*/
|
||||
|
||||
var value = {};
|
||||
var obj;
|
||||
var obj = {
|
||||
method() {
|
||||
return super.toString;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
Object.prototype.Test262Attr = value;
|
||||
obj = {
|
||||
Test262Attr: null,
|
||||
method() {
|
||||
return super.Test262Attr;
|
||||
}
|
||||
};
|
||||
assert.sameValue(obj.method(), value);
|
||||
} finally {
|
||||
delete Object.prototype.Test262Attr;
|
||||
}
|
||||
obj.toString = null;
|
||||
|
||||
assert.sameValue(obj.method(), Object.prototype.toString);
|
||||
|
@ -8,19 +8,12 @@ es6id: 14.3.8
|
||||
features: [super]
|
||||
---*/
|
||||
|
||||
var value = {};
|
||||
var obj;
|
||||
var obj = {
|
||||
method(x = super.toString) {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
Object.prototype.Test262Attr = value;
|
||||
obj = {
|
||||
Test262Attr: null,
|
||||
method(x = super.Test262Attr) {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
obj.toString = null;
|
||||
|
||||
assert.sameValue(obj.method(), value);
|
||||
} finally {
|
||||
delete Object.prototype.Test262Attr;
|
||||
}
|
||||
assert.sameValue(obj.method(), Object.prototype.toString);
|
||||
|
Loading…
x
Reference in New Issue
Block a user