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 // Flags: --harmony-object-literals | 5 // Flags: --harmony-object-literals |
6 | 6 |
7 | 7 |
8 (function TestBasics() { | 8 (function TestBasics() { |
9 var x = 1; | 9 var x = 1; |
10 var object = {x}; | 10 var object = {x}; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 var yield = 1; | 42 var yield = 1; |
43 var object = {yield}; | 43 var object = {yield}; |
44 assertEquals(1, object.yield); | 44 assertEquals(1, object.yield); |
45 })(); | 45 })(); |
46 | 46 |
47 | 47 |
48 (function TestToString() { | 48 (function TestToString() { |
49 function f(x) { return {x}; } | 49 function f(x) { return {x}; } |
50 assertEquals('function f(x) { return {x}; }', f.toString()); | 50 assertEquals('function f(x) { return {x}; }', f.toString()); |
51 })(); | 51 })(); |
| 52 |
| 53 |
| 54 (function TestProtoName() { |
| 55 var __proto__ = 1; |
| 56 var object = { |
| 57 __proto__ |
| 58 }; |
| 59 assertEquals(Object.prototype, Object.getPrototypeOf(object)); |
| 60 assertEquals(1, object.__proto__); |
| 61 })(); |
| 62 |
| 63 |
| 64 (function TestProtoName2() { |
| 65 var __proto__ = 1; |
| 66 var p = {}; |
| 67 var object = { |
| 68 __proto__: p, |
| 69 __proto__, |
| 70 }; |
| 71 assertEquals(p, Object.getPrototypeOf(object)); |
| 72 assertEquals(1, object.__proto__); |
| 73 })(); |
OLD | NEW |