OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 (function TestBasics() { | 6 (function TestBasics() { |
7 var x = 1; | 7 var x = 1; |
8 var object = {x}; | 8 var object = {x}; |
9 assertEquals(1, object.x); | 9 assertEquals(1, object.x); |
10 })(); | 10 })(); |
11 | 11 |
12 | 12 |
| 13 (function TestBasicsGetSet() { |
| 14 var get = 1, set = 2; |
| 15 var object = {get, set}; |
| 16 assertEquals(1, object.get); |
| 17 assertEquals(2, object.set); |
| 18 })(); |
| 19 |
| 20 |
13 (function TestDescriptor() { | 21 (function TestDescriptor() { |
14 var x = 1; | 22 var x = 1; |
15 var object = {x}; | 23 var object = {x}; |
16 var descr = Object.getOwnPropertyDescriptor(object, 'x'); | 24 var descr = Object.getOwnPropertyDescriptor(object, 'x'); |
17 assertEquals(1, descr.value); | 25 assertEquals(1, descr.value); |
18 assertTrue(descr.enumerable); | 26 assertTrue(descr.enumerable); |
19 assertTrue(descr.writable); | 27 assertTrue(descr.writable); |
20 assertTrue(descr.configurable); | 28 assertTrue(descr.configurable); |
21 })(); | 29 })(); |
22 | 30 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 (function TestProtoName2() { | 70 (function TestProtoName2() { |
63 var __proto__ = 1; | 71 var __proto__ = 1; |
64 var p = {}; | 72 var p = {}; |
65 var object = { | 73 var object = { |
66 __proto__: p, | 74 __proto__: p, |
67 __proto__, | 75 __proto__, |
68 }; | 76 }; |
69 assertEquals(p, Object.getPrototypeOf(object)); | 77 assertEquals(p, Object.getPrototypeOf(object)); |
70 assertEquals(1, object.__proto__); | 78 assertEquals(1, object.__proto__); |
71 })(); | 79 })(); |
OLD | NEW |