summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/instn-star-equality.js
blob: 55e7182806b37129c48ac402087a46421a6ffe17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// |reftest| module
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: A single namespace is created for each module
esid: sec-moduledeclarationinstantiation
info: |
    [...]
    12. For each ImportEntry Record in in module.[[ImportEntries]], do
        a. Let importedModule be ? HostResolveImportedModule(module,
           in.[[ModuleRequest]]).
        b. If in.[[ImportName]] is "*", then
           i. Let namespace be ? GetModuleNamespace(importedModule).
           ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true).
           iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace).
    [...]

    15.2.1.18 Runtime Semantics: GetModuleNamespace

    1. Assert: module is an instance of a concrete subclass of Module Record.
    2. Let namespace be module.[[Namespace]].
    3. If namespace is undefined, then
       [...]
    4. Return namespace.
flags: [module]
---*/

import * as self1 from './instn-star-equality.js';
import * as self2 from './instn-star-equality.js';
import * as other1 from './instn-star-equality-other_FIXTURE.js';
import * as self3 from './instn-star-equality.js';
import * as other2 from './instn-star-equality-other_FIXTURE.js';
import { testNs } from './instn-star-equality-other_FIXTURE.js';

assert.sameValue(
  self1, self2, 'Local namespace objects from consecutive declarations'
);
assert.sameValue(
  self1, self3, 'Local namespace objects from non-consective declarations'
);
assert.sameValue(other1, other2, 'External namespace objects');
assert.sameValue(self1, testNs, 'Re-exported namespace objects');

assert.notSameValue(self1, other1);

reportCompare(0, 0);