Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: test/mjsunit/harmony/reflect.js

Issue 1397853005: [es6] Partially implement Reflect.preventExtensions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Sorry Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | test/mjsunit/harmony/reflect-prevent-extensions.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
OLDNEW
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | test/mjsunit/harmony/reflect-prevent-extensions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698