get-own-property-str-found-init.js (2451B)
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 initialized 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 5. Return PropertyDescriptor{[[Value]]: value, [[Writable]]: true, 15 [[Enumerable]]: true, [[Configurable]]: false }. 16 flags: [module] 17 ---*/ 18 19 import * as ns from './get-own-property-str-found-init.js'; 20 export var local1 = 201; 21 var local2 = 207; 22 export { local2 as renamed }; 23 export { local1 as indirect } from './get-own-property-str-found-init.js'; 24 export default 302; 25 var desc; 26 27 assert.sameValue( 28 Object.prototype.hasOwnProperty.call(ns, 'local1'), true 29 ); 30 desc = Object.getOwnPropertyDescriptor(ns, 'local1'); 31 assert.sameValue(desc.value, 201); 32 assert.sameValue(desc.enumerable, true, 'local1 enumerable'); 33 assert.sameValue(desc.writable, true, 'local1 writable'); 34 assert.sameValue(desc.configurable, false, 'local1 configurable'); 35 36 assert.sameValue( 37 Object.prototype.hasOwnProperty.call(ns, 'renamed'), true 38 ); 39 desc = Object.getOwnPropertyDescriptor(ns, 'renamed'); 40 assert.sameValue(desc.value, 207); 41 assert.sameValue(desc.enumerable, true, 'renamed enumerable'); 42 assert.sameValue(desc.writable, true, 'renamed writable'); 43 assert.sameValue(desc.configurable, false, 'renamed configurable'); 44 45 assert.sameValue( 46 Object.prototype.hasOwnProperty.call(ns, 'indirect'), true 47 ); 48 desc = Object.getOwnPropertyDescriptor(ns, 'indirect'); 49 assert.sameValue(desc.value, 201); 50 assert.sameValue(desc.enumerable, true, 'indirect enumerable'); 51 assert.sameValue(desc.writable, true, 'indirect writable'); 52 assert.sameValue(desc.configurable, false, 'indirect configurable'); 53 54 assert.sameValue( 55 Object.prototype.hasOwnProperty.call(ns, 'default'), true 56 ); 57 desc = Object.getOwnPropertyDescriptor(ns, 'default'); 58 assert.sameValue(desc.value, 302); 59 assert.sameValue(desc.enumerable, true, 'default enumerable'); 60 assert.sameValue(desc.writable, true, 'default writable'); 61 assert.sameValue(desc.configurable, false, 'default configurable'); 62 63 reportCompare(0, 0);