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

View File

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