mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 04:54:44 +02:00
Add Proxy callable return test
This commit is contained in:
parent
e4adfd8979
commit
abdc0fa441
24
test/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js
vendored
Normal file
24
test/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-shadowrealm.prototype.evaluate
|
||||||
|
description: >
|
||||||
|
ShadowRealm.prototype.evaluate wrapped proxy callable object.
|
||||||
|
features: [ShadowRealm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
typeof ShadowRealm.prototype.evaluate,
|
||||||
|
'function',
|
||||||
|
'This test must fail if ShadowRealm.prototype.evaluate is not a function'
|
||||||
|
);
|
||||||
|
|
||||||
|
const r = new ShadowRealm();
|
||||||
|
|
||||||
|
const proxyCallable = r.evaluate(`
|
||||||
|
function fn() { return 42; }
|
||||||
|
new Proxy(fn, {});
|
||||||
|
`);
|
||||||
|
|
||||||
|
assert.sameValue(typeof proxyCallable, 'function', 'wrapped proxy callable object is typeof function');
|
||||||
|
assert.sameValue(proxyCallable(), 42, 'wrappedpfn() returns 42');
|
Loading…
x
Reference in New Issue
Block a user