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 --allow-natives-syntax | 5 // Flags: --harmony-object-literals --allow-natives-syntax |
6 | 6 |
7 | 7 |
8 (function TestBasics() { | 8 (function TestBasics() { |
9 var object = { | 9 var object = { |
10 method() { | 10 method() { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 assertEquals(1, calls); | 239 assertEquals(1, calls); |
240 })(); | 240 })(); |
241 | 241 |
242 | 242 |
243 (function TestGeneratorToString() { | 243 (function TestGeneratorToString() { |
244 var object = { | 244 var object = { |
245 *method() { yield 1; } | 245 *method() { yield 1; } |
246 }; | 246 }; |
247 assertEquals('*method() { yield 1; }', object.method.toString()); | 247 assertEquals('*method() { yield 1; }', object.method.toString()); |
248 })(); | 248 })(); |
| 249 |
| 250 |
| 251 (function TestProtoName() { |
| 252 var object = { |
| 253 __proto__() { |
| 254 return 1; |
| 255 } |
| 256 }; |
| 257 assertEquals(Object.prototype, Object.getPrototypeOf(object)); |
| 258 assertEquals(1, object.__proto__()); |
| 259 })(); |
| 260 |
| 261 |
| 262 (function TestProtoName2() { |
| 263 var p = {}; |
| 264 var object = { |
| 265 __proto__() { |
| 266 return 1; |
| 267 }, |
| 268 __proto__: p |
| 269 }; |
| 270 assertEquals(p, Object.getPrototypeOf(object)); |
| 271 assertEquals(1, object.__proto__()); |
| 272 })(); |
OLD | NEW |