Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / language / global-code / script-decl-lex-var-declared-via-eval-strict-strict.js
blob34c2685a807f8da774cc46481f3174333bae80bc
1 'use strict';
2 // Copyright (C) 2023 Alexey Shvayka. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-globaldeclarationinstantiation
6 description: No let binding collision with existing var declaration due to strict-mode eval().
7 info: |
8   PerformEval ( x, strictCaller, direct )
10   [...]
11   16. If direct is true, then
12     a. Let lexEnv be NewDeclarativeEnvironment(runningContext's LexicalEnvironment).
13   [...]
14   18. If strictEval is true, set varEnv to lexEnv.
15 flags: [onlyStrict]
16 ---*/
18 eval('var test262Var;');
19 eval('function test262Fn() {}');
21 $262.evalScript('let test262Var = 1;');
22 assert.sameValue(test262Var, 1);
24 $262.evalScript('const test262Fn = 2;');
25 assert.sameValue(test262Fn, 2);
27 reportCompare(0, 0);