Debian Codegraph @

js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-uninit.js

raw
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 esid: sec-module-namespace-exotic-objects-getownproperty-p
6 description: >
7 Behavior of the [[GetOwnProperty]] internal method with a string argument
8 describing an uninitialized binding
9 info: |
10 1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
11 2. Let exports be the value of O's [[Exports]] internal slot.
12 3. If P is not an element of exports, return undefined.
13 4. Let value be ? O.[[Get]](P, O).
14 flags: [module]
15 features: [let]
16 ---*/
17
18 import * as ns from './get-own-property-str-found-uninit.js';
19
20 assert.throws(ReferenceError, function() {
21 Object.prototype.hasOwnProperty.call(ns, 'local1');
22 }, 'hasOwnProperty: local1');
23 assert.throws(ReferenceError, function() {
24 Object.getOwnPropertyDescriptor(ns, 'local1');
25 }, 'getOwnPropertyDescriptor: local1');
26
27 assert.throws(ReferenceError, function() {
28 Object.prototype.hasOwnProperty.call(ns, 'renamed');
29 }, 'hasOwnProperty: renamed');
30 assert.throws(ReferenceError, function() {
31 Object.getOwnPropertyDescriptor(ns, 'renamed');
32 }, 'getOwnPropertyDescriptor: renamed');
33
34 assert.throws(ReferenceError, function() {
35 Object.prototype.hasOwnProperty.call(ns, 'indirect');
36 }, 'hasOwnProperty: indirect');
37 assert.throws(ReferenceError, function() {
38 Object.getOwnPropertyDescriptor(ns, 'indirect');
39 }, 'getOwnPropertyDescriptor: indirect');
40
41 assert.throws(ReferenceError, function() {
42 Object.prototype.hasOwnProperty.call(ns, 'default');
43 }, 'hasOwnProperty: default');
44 assert.throws(ReferenceError, function() {
45 Object.getOwnPropertyDescriptor(ns, 'default');
46 }, 'getOwnPropertyDescriptor: default');
47
48 export let local1 = 23;
49 let local2 = 45;
50 export { local2 as renamed };
51 export { local1 as indirect } from './get-own-property-str-found-uninit.js';
52 export default null;
53
54 reportCompare(0, 0);