blob: ee8bf44ded98dc8bb2bcc13a8dc7f4c561b2111c [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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
5assertThrows(function() {
6 Object.getOwnPropertyDescriptor(null, 'x');
7}, TypeError);
8
9
10assertThrows(function() {
11 Object.getOwnPropertyDescriptor(undefined, 'x');
12}, TypeError);
13
14
15assertEquals({
16 configurable: false,
17 enumerable: false,
18 value: 3,
19 writable: false,
20}, Object.getOwnPropertyDescriptor('abc', 'length'));
21
22
23assertEquals({
24 configurable: false,
25 enumerable: true,
26 value: 'a',
27 writable: false,
28}, Object.getOwnPropertyDescriptor('abc', 0));
29
30
31assertSame(undefined, Object.getOwnPropertyDescriptor(42, 'x'));
32assertSame(undefined, Object.getOwnPropertyDescriptor(true, 'x'));
33assertSame(undefined, Object.getOwnPropertyDescriptor(false, 'x'));
34assertSame(undefined, Object.getOwnPropertyDescriptor(Symbol(), 'x'));