-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3210 from tc39/rwaldron/shadowrealm-fixups
ShadowRealm: improved existing and additional coverage
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 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'); | ||
assert.sameValue(proxyCallable instanceof Proxy, false, 'the wrapped function "hides" the proxy instance'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters