| 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-computed-property-names | 5 // Flags: --harmony-computed-property-names |
| 6 | 6 |
| 7 | 7 |
| 8 function ID(x) { | 8 function ID(x) { |
| 9 return x; | 9 return x; |
| 10 } | 10 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 assertArrayEquals(['1', '2', 'a', 'c'], Object.keys(object)); | 121 assertArrayEquals(['1', '2', 'a', 'c'], Object.keys(object)); |
| 122 })(); | 122 })(); |
| 123 | 123 |
| 124 | 124 |
| 125 (function TestDoubleName() { | 125 (function TestDoubleName() { |
| 126 var object = { | 126 var object = { |
| 127 [1.2]: 'A', | 127 [1.2]: 'A', |
| 128 [1e55]: 'B', | 128 [1e55]: 'B', |
| 129 [0.000001]: 'C', | 129 [0.000001]: 'C', |
| 130 [-0]: 'D', | 130 [-0]: 'D', |
| 131 [Infinity]: 'E', | 131 // TODO(arv): https://code.google.com/p/v8/issues/detail?id=3815 |
| 132 [-Infinity]: 'F', | 132 // [Infinity]: 'E', |
| 133 // [-Infinity]: 'F', |
| 133 [NaN]: 'G', | 134 [NaN]: 'G', |
| 134 }; | 135 }; |
| 135 assertEquals('A', object['1.2']); | 136 assertEquals('A', object['1.2']); |
| 136 assertEquals('B', object['1e+55']); | 137 assertEquals('B', object['1e+55']); |
| 137 assertEquals('C', object['0.000001']); | 138 assertEquals('C', object['0.000001']); |
| 138 assertEquals('D', object[0]); | 139 assertEquals('D', object[0]); |
| 139 assertEquals('E', object[Infinity]); | 140 // TODO(arv): https://code.google.com/p/v8/issues/detail?id=3815 |
| 140 assertEquals('F', object[-Infinity]); | 141 // assertEquals('E', object[Infinity]); |
| 142 // assertEquals('F', object[-Infinity]); |
| 141 assertEquals('G', object[NaN]); | 143 assertEquals('G', object[NaN]); |
| 142 })(); | 144 })(); |
| 143 | 145 |
| 144 | 146 |
| 145 (function TestGetter() { | 147 (function TestGetter() { |
| 146 var object = { | 148 var object = { |
| 147 get ['a']() { | 149 get ['a']() { |
| 148 return 'A'; | 150 return 'A'; |
| 149 } | 151 } |
| 150 }; | 152 }; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 }; | 263 }; |
| 262 assertEquals(proto, Object.getPrototypeOf(object)); | 264 assertEquals(proto, Object.getPrototypeOf(object)); |
| 263 | 265 |
| 264 var object = { | 266 var object = { |
| 265 ['__proto__']: proto | 267 ['__proto__']: proto |
| 266 }; | 268 }; |
| 267 assertEquals(Object.prototype, Object.getPrototypeOf(object)); | 269 assertEquals(Object.prototype, Object.getPrototypeOf(object)); |
| 268 assertEquals(proto, object.__proto__); | 270 assertEquals(proto, object.__proto__); |
| 269 assertTrue(object.hasOwnProperty('__proto__')); | 271 assertTrue(object.hasOwnProperty('__proto__')); |
| 270 })(); | 272 })(); |
| OLD | NEW |