Make proxy traps helper test a bit more robust.

Per https://github.com/tc39/test262/pull/484#discussion_r53228232
This commit is contained in:
Jordan Harband 2016-02-17 12:50:26 -08:00
parent d530c87b41
commit 59dad9172b
1 changed files with 6 additions and 3 deletions

View File

@ -7,8 +7,7 @@ id: pending
author: Jordan Harband
includes: [proxyTrapsHelper.js]
---*/
var traps = allowProxyTraps({
var overrides = {
getPrototypeOf: function () {},
setPrototypeOf: function () {},
isExtensible: function () {},
@ -23,12 +22,16 @@ var traps = allowProxyTraps({
ownKeys: function () {},
apply: function () {},
construct: function () {},
});
};
var traps = allowProxyTraps(overrides);
function assertTrapSucceeds(trap) {
if (typeof traps[trap] !== 'function') {
throw new Test262Error('trap ' + trap + ' is not a function');
}
if (traps[trap] !== overrides[trap]) {
throw new Test262Error('trap ' + trap + ' was not overriden in allowProxyTraps');
}
var threw = false;
try {
traps[trap]();