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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 let proto = tgt.__proto__; | 224 let proto = tgt.__proto__; |
225 tgt.__proto__ = { get foo() {return this.bla} }; | 225 tgt.__proto__ = { get foo() {return this.bla} }; |
226 assertEquals(true, Reflect.deleteProperty(tgt, "foo")); | 226 assertEquals(true, Reflect.deleteProperty(tgt, "foo")); |
227 tgt.__proto__ = proto; | 227 tgt.__proto__ = proto; |
228 } | 228 } |
229 })(); | 229 })(); |
230 | 230 |
231 | 231 |
232 | 232 |
233 //////////////////////////////////////////////////////////////////////////////// | 233 //////////////////////////////////////////////////////////////////////////////// |
| 234 // Reflect.getPrototypeOf |
| 235 |
| 236 |
| 237 (function testReflectGetPrototypeOfArity() { |
| 238 assertEquals(1, Reflect.getPrototypeOf.length); |
| 239 })(); |
| 240 |
| 241 |
| 242 (function testReflectDeletePropertyOnNonObject() { |
| 243 assertThrows(function() { Reflect.getPrototypeOf(); }, TypeError); |
| 244 assertThrows(function() { Reflect.getPrototypeOf(42); }, TypeError); |
| 245 assertThrows(function() { Reflect.getPrototypeOf(null); }, TypeError); |
| 246 })(); |
| 247 |
| 248 |
| 249 // See reflect-get-prototype-of.js for further tests. |
| 250 |
| 251 |
| 252 |
| 253 //////////////////////////////////////////////////////////////////////////////// |
234 // Reflect.isExtensible | 254 // Reflect.isExtensible |
235 | 255 |
236 | 256 |
237 (function testReflectIsExtensibleArity() { | 257 (function testReflectIsExtensibleArity() { |
238 assertEquals(1, Reflect.isExtensible.length); | 258 assertEquals(1, Reflect.isExtensible.length); |
239 })(); | 259 })(); |
240 | 260 |
241 | 261 |
242 (function testReflectIsExtensibleOnNonObject() { | 262 (function testReflectIsExtensibleOnNonObject() { |
243 assertThrows(function() { Reflect.isExtensible(); }, TypeError); | 263 assertThrows(function() { Reflect.isExtensible(); }, TypeError); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); | 312 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); |
293 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); | 313 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); |
294 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); | 314 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); |
295 })(); | 315 })(); |
296 | 316 |
297 | 317 |
298 // See reflect-prevent-extensions.js for further tests. | 318 // See reflect-prevent-extensions.js for further tests. |
299 | 319 |
300 // TODO(neis): Need proxies to test the situation where | 320 // TODO(neis): Need proxies to test the situation where |
301 // [[preventExtensions]] returns false. | 321 // [[preventExtensions]] returns false. |
OLD | NEW |