summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-init.js
blob: 148a12b6cdb8a03b09546a03788c2b06598d432d (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// |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.
/*---
esid: sec-module-namespace-exotic-objects-getownproperty-p
description: >
    Behavior of the [[GetOwnProperty]] internal method with a string argument
    describing an initialized binding
info: |
    1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
    2. Let exports be the value of O's [[Exports]] internal slot.
    3. If P is not an element of exports, return undefined.
    4. Let value be ? O.[[Get]](P, O).
    5. Return PropertyDescriptor{[[Value]]: value, [[Writable]]: true,
       [[Enumerable]]: true, [[Configurable]]: false }.
flags: [module]
---*/

import * as ns from './get-own-property-str-found-init.js';
export var local1 = 201;
var local2 = 207;
export { local2 as renamed };
export { local1 as indirect } from './get-own-property-str-found-init.js';
export default 302;
var desc;

assert.sameValue(
  Object.prototype.hasOwnProperty.call(ns, 'local1'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'local1');
assert.sameValue(desc.value, 201);
assert.sameValue(desc.enumerable, true, 'local1 enumerable');
assert.sameValue(desc.writable, true, 'local1 writable');
assert.sameValue(desc.configurable, false, 'local1 configurable');

assert.sameValue(
  Object.prototype.hasOwnProperty.call(ns, 'renamed'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'renamed');
assert.sameValue(desc.value, 207);
assert.sameValue(desc.enumerable, true, 'renamed enumerable');
assert.sameValue(desc.writable, true, 'renamed writable');
assert.sameValue(desc.configurable, false, 'renamed configurable');

assert.sameValue(
  Object.prototype.hasOwnProperty.call(ns, 'indirect'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'indirect');
assert.sameValue(desc.value, 201);
assert.sameValue(desc.enumerable, true, 'indirect enumerable');
assert.sameValue(desc.writable, true, 'indirect writable');
assert.sameValue(desc.configurable, false, 'indirect configurable');

assert.sameValue(
  Object.prototype.hasOwnProperty.call(ns, 'default'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'default');
assert.sameValue(desc.value, 302);
assert.sameValue(desc.enumerable, true, 'default enumerable');
assert.sameValue(desc.writable, true, 'default writable');
assert.sameValue(desc.configurable, false, 'default configurable');

reportCompare(0, 0);