OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 // Flags: --harmony-object-literals | |
6 | |
7 | |
8 (function TestBasics() { | |
9 var x = 1; | |
10 var object = {x}; | |
11 assertEquals(1, object.x); | |
12 })(); | |
13 | |
14 | |
15 (function TestDescriptor() { | |
16 var x = 1; | |
17 var object = {x}; | |
18 var descr = Object.getOwnPropertyDescriptor(object, 'x'); | |
19 assertEquals(1, descr.value); | |
20 assertTrue(descr.enumerable); | |
21 assertTrue(descr.writable); | |
22 assertTrue(descr.configurable); | |
23 })(); | |
24 | |
25 | |
26 (function TestNotDefined() { | |
27 'use strict'; | |
28 assertThrows(function() { | |
29 return {notDefined}; | |
30 }, ReferenceError); | |
31 })(); | |
32 | |
33 | |
34 (function TestLet() { | |
35 var let = 1; | |
36 var object = {let}; | |
37 assertEquals(1, object.let); | |
38 })(); | |
39 | |
40 | |
41 (function TestYieldInFunction() { | |
42 var yield = 1; | |
43 var object = {yield}; | |
44 assertEquals(1, object.yield); | |
45 })(); | |
46 | |
47 | |
48 (function TestToString() { | |
49 function f(x) { return {x}; } | |
50 assertEquals('function f(x) { return {x}; }', f.toString()); | |
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 |