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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 //////////////////////////////////////////////////////////////////////////////// | 233 //////////////////////////////////////////////////////////////////////////////// |
234 // Reflect.getPrototypeOf | 234 // Reflect.getPrototypeOf |
235 | 235 |
236 | 236 |
237 (function testReflectGetPrototypeOfArity() { | 237 (function testReflectGetPrototypeOfArity() { |
238 assertEquals(1, Reflect.getPrototypeOf.length); | 238 assertEquals(1, Reflect.getPrototypeOf.length); |
239 })(); | 239 })(); |
240 | 240 |
241 | 241 |
242 (function testReflectDeletePropertyOnNonObject() { | 242 (function testReflectGetPrototypeOnNonObject() { |
243 assertThrows(function() { Reflect.getPrototypeOf(); }, TypeError); | 243 assertThrows(function() { Reflect.getPrototypeOf(); }, TypeError); |
244 assertThrows(function() { Reflect.getPrototypeOf(42); }, TypeError); | 244 assertThrows(function() { Reflect.getPrototypeOf(42); }, TypeError); |
245 assertThrows(function() { Reflect.getPrototypeOf(null); }, TypeError); | 245 assertThrows(function() { Reflect.getPrototypeOf(null); }, TypeError); |
246 })(); | 246 })(); |
247 | 247 |
248 | 248 |
249 // See reflect-get-prototype-of.js for further tests. | 249 // See reflect-get-prototype-of.js for further tests. |
250 | 250 |
251 | 251 |
252 | 252 |
253 //////////////////////////////////////////////////////////////////////////////// | 253 //////////////////////////////////////////////////////////////////////////////// |
| 254 // Reflect.setPrototypeOf |
| 255 |
| 256 |
| 257 (function testReflectSetPrototypeOfArity() { |
| 258 assertEquals(2, Reflect.setPrototypeOf.length); |
| 259 })(); |
| 260 |
| 261 |
| 262 (function testReflectSetPrototypeOfOnNonObject() { |
| 263 assertThrows(function() { Reflect.setPrototypeOf(undefined, {}); }, |
| 264 TypeError); |
| 265 assertThrows(function() { Reflect.setPrototypeOf(42, {}); }, TypeError); |
| 266 assertThrows(function() { Reflect.setPrototypeOf(null, {}); }, TypeError); |
| 267 |
| 268 assertThrows(function() { Reflect.setPrototypeOf({}, undefined); }, |
| 269 TypeError); |
| 270 assertThrows(function() { Reflect.setPrototypeOf({}, 42); }, TypeError); |
| 271 assertTrue(Reflect.setPrototypeOf({}, null)); |
| 272 })(); |
| 273 |
| 274 |
| 275 // See reflect-set-prototype-of.js for further tests. |
| 276 |
| 277 |
| 278 |
| 279 //////////////////////////////////////////////////////////////////////////////// |
254 // Reflect.isExtensible | 280 // Reflect.isExtensible |
255 | 281 |
256 | 282 |
257 (function testReflectIsExtensibleArity() { | 283 (function testReflectIsExtensibleArity() { |
258 assertEquals(1, Reflect.isExtensible.length); | 284 assertEquals(1, Reflect.isExtensible.length); |
259 })(); | 285 })(); |
260 | 286 |
261 | 287 |
262 (function testReflectIsExtensibleOnNonObject() { | 288 (function testReflectIsExtensibleOnNonObject() { |
263 assertThrows(function() { Reflect.isExtensible(); }, TypeError); | 289 assertThrows(function() { Reflect.isExtensible(); }, TypeError); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); | 338 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); |
313 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); | 339 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); |
314 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); | 340 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); |
315 })(); | 341 })(); |
316 | 342 |
317 | 343 |
318 // See reflect-prevent-extensions.js for further tests. | 344 // See reflect-prevent-extensions.js for further tests. |
319 | 345 |
320 // TODO(neis): Need proxies to test the situation where | 346 // TODO(neis): Need proxies to test the situation where |
321 // [[preventExtensions]] returns false. | 347 // [[preventExtensions]] returns false. |
OLD | NEW |