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:
Mike Pennisi 2015-05-26 12:33:20 -04:00
parent 31bdf48bec
commit 30a4a5da7d
4 changed files with 30 additions and 53 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);