Lines Matching full:reflect
5 // Flags: --harmony-reflect
70 // Reflect.get
74 assertEquals(2, Reflect.get.length);
79 assertThrows(function() { Reflect.get(); }, TypeError);
80 assertThrows(function() { Reflect.get(42, "bla"); }, TypeError);
81 assertThrows(function() { Reflect.get(null, "bla"); }, TypeError);
89 assertEquals(42, Reflect.get(target, a));
90 assertThrowsEquals(function() { Reflect.get(target, b); }, "gaga");
98 assertEquals(true, Reflect.get(target, "bla"));
99 assertEquals(true, Reflect.get(target, "bla", target));
100 assertEquals(true, Reflect.get(target, "bla", receiver));
101 assertEquals(42, Reflect.get(target, 4));
102 assertEquals(42, Reflect.get(target, 4, target));
103 assertEquals(42, Reflect.get(target, 4, receiver));
104 assertEquals(42, Reflect.get(target, "4"));
105 assertEquals(42, Reflect.get(target, "4", target));
106 assertEquals(42, Reflect.get(target, "4", receiver));
107 assertEquals("foo", Reflect.get(target, sym));
108 assertEquals("foo", Reflect.get(target, sym, target));
109 assertEquals("foo", Reflect.get(target, sym, receiver));
110 assertEquals(43, Reflect.get(target, "noconf"));
111 assertEquals(43, Reflect.get(target, "noconf", target));
112 assertEquals(43, Reflect.get(target, "noconf", receiver));
113 assertEquals(true, Reflect.get(target, "getter"));
114 assertEquals(true, Reflect.get(target, "getter", target));
115 assertEquals(false, Reflect.get(target, "getter", receiver));
116 assertEquals(undefined, Reflect.get(target, "setter"));
117 assertEquals(undefined, Reflect.get(target, "setter", target));
118 assertEquals(undefined, Reflect.get(target, "setter", receiver));
119 assertEquals(undefined, Reflect.get(target, "foo"));
120 assertEquals(undefined, Reflect.get(target, "foo", target));
121 assertEquals(undefined, Reflect.get(target, "foo", receiver));
122 assertEquals(undefined, Reflect.get(target, 666));
123 assertEquals(undefined, Reflect.get(target, 666, target));
124 assertEquals(undefined, Reflect.get(target, 666, receiver));
128 assertEquals(true, Reflect.get(target, "foo"));
129 assertEquals(true, Reflect.get(target, "foo", target));
130 assertEquals(false, Reflect.get(target, "foo", receiver));
138 // Reflect.set
142 assertEquals(3, Reflect.set.length);
147 assertThrows(function() { Reflect.set(); }, TypeError);
148 assertThrows(function() { Reflect.set(42, "bla"); }, TypeError);
149 assertThrows(function() { Reflect.set(null, "bla"); }, TypeError);
157 assertTrue(Reflect.set(target, a, 42));
159 assertThrowsEquals(function() { Reflect.set(target, b, 42); }, "gaga");
168 assertTrue(Reflect.set(target, "bla", value));
172 assertTrue(Reflect.set(target, "bla", value, target));
176 assertTrue(Reflect.set(target, "bla", value, receiver));
182 assertTrue(Reflect.set(target, 4, value));
186 assertTrue(Reflect.set(target, 4, value, target));
190 assertTrue(Reflect.set(target, 4, value, receiver));
196 assertTrue(Reflect.set(target, sym, value));
200 assertTrue(Reflect.set(target, sym, value, target));
204 assertTrue(Reflect.set(target, sym, value, receiver));
210 assertTrue(Reflect.set(target, "noconf", value));
214 assertTrue(Reflect.set(target, "noconf", value, target));
218 assertTrue(Reflect.set(target, "noconf", value, receiver));
223 assertTrue(Reflect.set(target, "setter", value));
227 assertTrue(Reflect.set(target, "setter", value, target));
231 assertTrue(Reflect.set(target, "setter", value, receiver));
236 assertFalse(Reflect.set(target, "nowrite", value));
239 assertFalse(Reflect.set(target, "nowrite", value, target));
242 assertFalse(Reflect.set(target, "nowrite", value, receiver));
247 assertFalse(Reflect.set({}, "nowrite", value, target));
250 assertFalse(Reflect.set({}, "unknown", 0, {set unknown(x) {}}));
251 assertFalse(Reflect.set(target, "unknown", value, {set unknown(x) {}}));
252 assertFalse(Reflect.set(target, "bla", value, {set bla(x) {}}));
253 assertFalse(Reflect.set(target, "bla", value, {get bla() {}}));
256 assertTrue(Reflect.set({set bla(x) {}}), "bla", value, target);
257 assertFalse(Reflect.set({get bla() {}}, "bla", value, target));
260 assertFalse(Reflect.set({}, "bla", value, null));
261 assertFalse(Reflect.set({bla: 42}, "bla", value, null));
264 assertTrue(Reflect.set(target, "setter2", value, null));
265 assertFalse(Reflect.set(target, "getter", value, null));
272 assertTrue(Reflect.set(target, "bla", value, receiver2));
273 assertTrue(Reflect.set(target, "not_in_target", value, receiver2));
280 // Reflect.has
284 assertEquals(2, Reflect.has.length);
289 assertThrows(function() { Reflect.has(); }, TypeError);
290 assertThrows(function() { Reflect.has(42, "bla"); }, TypeError);
291 assertThrows(function() { Reflect.has(null, "bla"); }, TypeError);
299 assertTrue(Reflect.has(target, a));
300 assertThrowsEquals(function() { Reflect.has(target, b); }, "gaga");
307 assertTrue(Reflect.has(target, "bla"));
308 assertTrue(Reflect.has(target, 4));
309 assertTrue(Reflect.has(target, "4"));
310 assertTrue(Reflect.has(target, sym));
311 assertTrue(Reflect.has(target, "noconf"));
312 assertTrue(Reflect.has(target, "getter"));
313 assertTrue(Reflect.has(target, "setter"));
314 assertFalse(Reflect.has(target, "foo"));
315 assertFalse(Reflect.has(target, 666));
319 assertEquals(true, Reflect.has(target, "foo"));
327 // Reflect.defineProperty
331 assertEquals(3, Reflect.defineProperty.length);
336 assertThrows(function() { Reflect.defineProperty(); }, TypeError);
337 assertThrows(function() { Reflect.defineProperty(42, "bla"); }, TypeError);
338 assertThrows(function() { Reflect.defineProperty(null, "bla"); }, TypeError);
339 assertThrows(function() { Reflect.defineProperty({}, "bla"); }, TypeError);
340 assertThrows(function() { Reflect.defineProperty({}, "bla", 42); },
342 assertThrows(function() { Reflect.defineProperty({}, "bla", null); },
351 assertTrue(Reflect.defineProperty(target, a, {value: 42}));
353 assertThrowsEquals(function() { Reflect.defineProperty(target, b); }, "gaga");
357 // See reflect-define-property.js for further tests.
362 // Reflect.deleteProperty
366 assertEquals(2, Reflect.deleteProperty.length);
371 assertThrows(function() { Reflect.deleteProperty(); }, TypeError);
372 assertThrows(function() { Reflect.deleteProperty(42, "bla"); }, TypeError);
373 assertThrows(function() { Reflect.deleteProperty(null, "bla"); }, TypeError);
381 assertTrue(Reflect.deleteProperty(target, a));
382 assertThrowsEquals(function() { Reflect.deleteProperty(target, b); }, "gaga");
389 assertTrue(Reflect.deleteProperty(target, "bla"));
392 assertFalse(Reflect.deleteProperty(target, 4));
394 assertTrue(Reflect.deleteProperty(target, 4));
397 assertTrue(Reflect.deleteProperty(target, sym));
399 assertFalse(Reflect.deleteProperty(target, "noconf"));
401 assertTrue(Reflect.deleteProperty(target, "getter"));
402 assertTrue(Reflect.deleteProperty(target, "setter"));
403 assertTrue(Reflect.deleteProperty(target, "foo"));
404 assertTrue(Reflect.deleteProperty(target, 666));
408 assertEquals(true, Reflect.deleteProperty(target, "foo"));
416 // Reflect.getPrototypeOf
420 assertEquals(1, Reflect.getPrototypeOf.length);
425 assertThrows(function() { Reflect.getPrototypeOf(); }, TypeError);
426 assertThrows(function() { Reflect.getPrototypeOf(42); }, TypeError);
427 assertThrows(function() { Reflect.getPrototypeOf(null); }, TypeError);
431 // See reflect-get-prototype-of.js for further tests.
436 // Reflect.setPrototypeOf
440 assertEquals(2, Reflect.setPrototypeOf.length);
445 assertThrows(function() { Reflect.setPrototypeOf(undefined, {}); },
447 assertThrows(function() { Reflect.setPrototypeOf(42, {}); }, TypeError);
448 assertThrows(function() { Reflect.setPrototypeOf(null, {}); }, TypeError);
450 assertThrows(function() { Reflect.setPrototypeOf({}, undefined); },
452 assertThrows(function() { Reflect.setPrototypeOf({}, 42); }, TypeError);
453 assertTrue(Reflect.setPrototypeOf({}, null));
457 // See reflect-set-prototype-of.js for further tests.
462 // Reflect.isExtensible
466 assertEquals(1, Reflect.isExtensible.length);
471 assertThrows(function() { Reflect.isExtensible(); }, TypeError);
472 assertThrows(function() { Reflect.isExtensible(42); }, TypeError);
473 assertThrows(function() { Reflect.isExtensible(null); }, TypeError);
482 assertTrue(Reflect.isExtensible(target));
484 assertFalse(Reflect.isExtensible(target));
491 // Reflect.enumerate
495 assertEquals(1, Reflect.enumerate.length);
500 assertThrows(function() { Reflect.enumerate(); }, TypeError);
501 assertThrows(function() { Reflect.enumerate(42); }, TypeError);
502 assertThrows(function() { Reflect.enumerate(null); }, TypeError);
506 // See reflect-enumerate*.js for further tests.
511 // Reflect.getOwnPropertyDescriptor
515 assertEquals(2, Reflect.getOwnPropertyDescriptor.length);
520 assertThrows(function() { Reflect.getOwnPropertyDescriptor(); }, TypeError);
521 assertThrows(function() { Reflect.getOwnPropertyDescriptor(42); },
523 assertThrows(function() { Reflect.getOwnPropertyDescriptor(null); },
532 assertEquals(42, Reflect.getOwnPropertyDescriptor(target, a).value);
533 assertThrowsEquals(() => Reflect.getOwnPropertyDescriptor(target, b), "gaga");
537 // See reflect-get-own-property-descriptor.js for further tests.
542 // Reflect.ownKeys
546 assertEquals(1, Reflect.ownKeys.length);
551 assertThrows(function() { Reflect.ownKeys(); }, TypeError);
552 assertThrows(function() { Reflect.ownKeys(42); }, TypeError);
553 assertThrows(function() { Reflect.ownKeys(null); }, TypeError);
558 assertEquals(["z", "y", "x"], Reflect.ownKeys({z: 3, y: 2, x: 1}));
559 assertEquals(["length"], Reflect.ownKeys([]));
566 Reflect.ownKeys(obj));
570 // See reflect-own-keys.js for further tests.
575 // Reflect.preventExtensions
579 assertEquals(1, Reflect.preventExtensions.length);
584 assertThrows(function() { Reflect.preventExtensions(); }, TypeError);
585 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError);
586 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError);
590 // See reflect-prevent-extensions.js for further tests.