OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-reflect | 5 // Flags: --harmony-reflect |
6 | 6 |
7 // TODO(neis): Test with proxies. | 7 // TODO(neis): Test with proxies. |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 | 241 |
242 (function testReflectIsExtensibleOnNonObject() { | 242 (function testReflectIsExtensibleOnNonObject() { |
243 assertThrows(function() { Reflect.isExtensible(); }, TypeError); | 243 assertThrows(function() { Reflect.isExtensible(); }, TypeError); |
244 assertThrows(function() { Reflect.isExtensible(42); }, TypeError); | 244 assertThrows(function() { Reflect.isExtensible(42); }, TypeError); |
245 assertThrows(function() { Reflect.isExtensible(null); }, TypeError); | 245 assertThrows(function() { Reflect.isExtensible(null); }, TypeError); |
246 })(); | 246 })(); |
247 | 247 |
248 | 248 |
249 (function testReflectIsExtensibleOnObject() { | 249 (function testReflectIsExtensibleOnObject() { |
250 // This should be the last test as it modifies the objects irreversibly. | 250 // This should be the last test on [objects] as it modifies them irreversibly. |
251 for (let tgt of objects) { | 251 for (let tgt of objects) { |
252 prepare(tgt); | 252 prepare(tgt); |
253 if (tgt instanceof Int32Array) continue; // issue v8:4460 | 253 if (tgt instanceof Int32Array) continue; // issue v8:4460 |
254 assertTrue(Reflect.isExtensible(tgt)); | 254 assertTrue(Reflect.isExtensible(tgt)); |
255 Object.preventExtensions(tgt); | 255 Object.preventExtensions(tgt); |
256 assertFalse(Reflect.isExtensible(tgt)); | 256 assertFalse(Reflect.isExtensible(tgt)); |
257 } | 257 } |
258 })(); | 258 })(); |
259 | 259 |
260 | 260 |
261 | 261 |
262 //////////////////////////////////////////////////////////////////////////////// | 262 //////////////////////////////////////////////////////////////////////////////// |
263 // Reflect.enumerate | 263 // Reflect.enumerate |
264 | 264 |
265 | 265 |
266 (function testReflectEnumerateArity() { | 266 (function testReflectEnumerateArity() { |
267 assertEquals(1, Reflect.enumerate.length); | 267 assertEquals(1, Reflect.enumerate.length); |
268 })(); | 268 })(); |
269 | 269 |
270 | 270 |
271 (function testReflectEnumerateOnNonObject() { | 271 (function testReflectEnumerateOnNonObject() { |
272 assertThrows(function() { Reflect.enumerate(); }, TypeError); | 272 assertThrows(function() { Reflect.enumerate(); }, TypeError); |
273 assertThrows(function() { Reflect.enumerate(42); }, TypeError); | 273 assertThrows(function() { Reflect.enumerate(42); }, TypeError); |
274 assertThrows(function() { Reflect.enumerate(null); }, TypeError); | 274 assertThrows(function() { Reflect.enumerate(null); }, TypeError); |
275 })(); | 275 })(); |
276 | 276 |
277 | 277 |
278 // See reflect-enumerate*.js for further tests. | 278 // See reflect-enumerate*.js for further tests. |
| 279 |
| 280 |
| 281 |
| 282 //////////////////////////////////////////////////////////////////////////////// |
| 283 // Reflect.preventExtensions |
| 284 |
| 285 |
| 286 (function testReflectPreventExtensionsArity() { |
| 287 assertEquals(1, Reflect.preventExtensions.length); |
| 288 })(); |
| 289 |
| 290 |
| 291 (function testReflectPreventExtensionsOnNonObject() { |
| 292 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); |
| 293 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); |
| 294 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); |
| 295 })(); |
| 296 |
| 297 |
| 298 // See reflect-prevent-extensions.js for further tests. |
| 299 |
| 300 // TODO(neis): Need proxies to test the situation where |
| 301 // [[preventExtensions]] returns false. |
OLD | NEW |