mirror of https://github.com/tc39/test262.git
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
test/language/expressions/object/method-definition
|
@ -10,18 +10,14 @@ author: Sam Mikes
|
||||||
description: GeneratorMethod body uses SuperProperty (allowed)
|
description: GeneratorMethod body uses SuperProperty (allowed)
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var value = {};
|
|
||||||
var obj;
|
var obj;
|
||||||
|
|
||||||
try {
|
var obj = {
|
||||||
Object.prototype.Test262Attr = value;
|
*foo() {
|
||||||
obj = {
|
return super.toString;
|
||||||
*foo() {
|
}
|
||||||
return super.Test262Attr;
|
};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.sameValue(obj.foo().next().value, value);
|
obj.toString = null;
|
||||||
} finally {
|
|
||||||
delete Object.prototype.Test262Attr;
|
assert.sameValue(obj.foo().next().value, Object.prototype.toString);
|
||||||
}
|
|
||||||
|
|
|
@ -11,18 +11,12 @@ description: GeneratorMethod uses SuperProperty (allowed)
|
||||||
features: [ default-arg, generator, super ]
|
features: [ default-arg, generator, super ]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var value = {};
|
var obj = {
|
||||||
var obj;
|
*foo(a = super.toString) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
obj.toString = null;
|
||||||
Object.prototype.Test262Attr = value;
|
|
||||||
obj = {
|
|
||||||
*foo(a = super.Test262Attr) {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.sameValue(obj.foo().next().value, value);
|
assert.sameValue(obj.foo().next().value, Object.prototype.toString);
|
||||||
} finally {
|
|
||||||
delete Object.prototype.Test262Attr;
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,18 +8,12 @@ es6id: 14.3.8
|
||||||
features: [super]
|
features: [super]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var value = {};
|
var obj = {
|
||||||
var obj;
|
method() {
|
||||||
|
return super.toString;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
obj.toString = null;
|
||||||
Object.prototype.Test262Attr = value;
|
|
||||||
obj = {
|
assert.sameValue(obj.method(), Object.prototype.toString);
|
||||||
Test262Attr: null,
|
|
||||||
method() {
|
|
||||||
return super.Test262Attr;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
assert.sameValue(obj.method(), value);
|
|
||||||
} finally {
|
|
||||||
delete Object.prototype.Test262Attr;
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,19 +8,12 @@ es6id: 14.3.8
|
||||||
features: [super]
|
features: [super]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var value = {};
|
var obj = {
|
||||||
var obj;
|
method(x = super.toString) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
obj.toString = null;
|
||||||
Object.prototype.Test262Attr = value;
|
|
||||||
obj = {
|
|
||||||
Test262Attr: null,
|
|
||||||
method(x = super.Test262Attr) {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.sameValue(obj.method(), value);
|
assert.sameValue(obj.method(), Object.prototype.toString);
|
||||||
} finally {
|
|
||||||
delete Object.prototype.Test262Attr;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue