Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / language / module-code / instn-local-bndng-gen.js
blob68129776c985973c66362d7ac7cec5367cdaf95c
1 // |reftest| module
2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: >
6     Mutable bindings are initialized in the lexical environment record prior to
7     execution for generator function declarations
8 esid: sec-moduledeclarationinstantiation
9 info: |
10     [...]
11     15. For each element d in varDeclarations do
12         a. For each element dn of the BoundNames of d do
13            i. If dn is not an element of declaredVarNames, then
14               1. Perform ! envRec.CreateMutableBinding(dn, false).
15               2. Call envRec.InitializeBinding(dn, undefined).
16               3. Append dn to declaredVarNames.
17     [...]
18 includes: [fnGlobalObject.js]
19 flags: [module]
20 ---*/
22 var global = fnGlobalObject();
24 assert.sameValue(
25   typeof test262, 'function', 'generator function value is hoisted'
27 assert.sameValue(
28   test262().next().value,
29   'test262',
30   'hoisted generator function value is correct'
32 assert.sameValue(
33   Object.getOwnPropertyDescriptor(global, 'test262'), undefined
36 test262 = null;
37 assert.sameValue(test262, null, 'binding is mutable');
38 assert.sameValue(
39   Object.getOwnPropertyDescriptor(global, 'test262'), undefined
42 function* test262() { return 'test262'; }
44 assert.sameValue(
45   test262, null, 'binding is not effected by evaluation of declaration'
47 assert.sameValue(
48   Object.getOwnPropertyDescriptor(global, 'test262'),
49   undefined,
50   'global binding is not effected by evaluation of declaration'
53 reportCompare(0, 0);