1 // Copyright 2015 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 assertThrows(function() { 6 Object.getOwnPropertyDescriptor(null, 'x'); 7 }, TypeError); 8 9 10 assertThrows(function() { 11 Object.getOwnPropertyDescriptor(undefined, 'x'); 12 }, TypeError); 13 14 15 assertEquals({ 16 configurable: false, 17 enumerable: false, 18 value: 3, 19 writable: false, 20 }, Object.getOwnPropertyDescriptor('abc', 'length')); 21 22 23 assertEquals({ 24 configurable: false, 25 enumerable: true, 26 value: 'a', 27 writable: false, 28 }, Object.getOwnPropertyDescriptor('abc', 0)); 29 30 31 assertSame(undefined, Object.getOwnPropertyDescriptor(42, 'x')); 32 assertSame(undefined, Object.getOwnPropertyDescriptor(true, 'x')); 33 assertSame(undefined, Object.getOwnPropertyDescriptor(false, 'x')); 34 assertSame(undefined, Object.getOwnPropertyDescriptor(Symbol(), 'x')); 35