mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 05:55:36 +02:00
Make proxy traps helper test a bit more robust.
Per https://github.com/tc39/test262/pull/484#discussion_r53228232
This commit is contained in:
parent
d530c87b41
commit
59dad9172b
@ -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]();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user