Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / language / module-code / eval-export-dflt-cls-named.js
blobf3f30ec72db4c2dd66f401634bb7bd74b6fd8769
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     Default "named" class declaration is correctly initialized upon
7     evaluation
8 esid: sec-moduleevaluation
9 info: |
10     [...]
11     16. Let result be the result of evaluating module.[[ECMAScriptCode]].
12     [...]
14     15.2.3.11 Runtime Semantics: Evaluation
16     ExportDeclaration : export default ClassDeclaration
18     [...]
19     3. Let className be the sole element of BoundNames of ClassDeclaration.
20     4. If className is "*default*", then
21        a. Let hasNameProperty be ? HasOwnProperty(value, "name").
22        b. If hasNameProperty is false, perform SetFunctionName(value,
23           "default").
24        c. Let env be the running execution context's LexicalEnvironment.
25        d. Perform ? InitializeBoundName("*default*", value, env).
26     5. Return NormalCompletion(empty).
27 flags: [module]
28 ---*/
30 export default class cName { valueOf() { return 45; } }
31 import C from './eval-export-dflt-cls-named.js';
33 assert.sameValue(new C().valueOf(), 45, 'binding initialized');
34 assert.sameValue(C.name, 'cName', 'correct name is assigned');
36 reportCompare(0, 0);