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

Side by Side Diff: test/mjsunit/object-prevent-extensions.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 | « test/mjsunit/harmony/reflect-prevent-extensions.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 assertEquals(undefined, obj2[1]); 81 assertEquals(undefined, obj2[1]);
82 82
83 var arr = new Array(); 83 var arr = new Array();
84 arr[1] = 10; 84 arr[1] = 10;
85 85
86 Object.preventExtensions(arr); 86 Object.preventExtensions(arr);
87 87
88 arr[2] = 42; 88 arr[2] = 42;
89 assertEquals(10, arr[1]); 89 assertEquals(10, arr[1]);
90 90
91 // We should still be able to change exiting elements. 91 // We should still be able to change existing elements.
92 arr[1]= 42; 92 arr[1]= 42;
93 assertEquals(42, arr[1]); 93 assertEquals(42, arr[1]);
94 94
95 95
96 // Test the the extensible flag is not inherited. 96 // Test the the extensible flag is not inherited.
97 var parent = {}; 97 var parent = {};
98 parent.x = 42; 98 parent.x = 42;
99 Object.preventExtensions(parent); 99 Object.preventExtensions(parent);
100 100
101 var child = Object.create(parent); 101 var child = Object.create(parent);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 obj = { prop1: 1, prop2: 2, 75: 'foo' }; 153 obj = { prop1: 1, prop2: 2, 75: 'foo' };
154 obj2 = { prop1: 3, prop2: 4, 150: 'bar' }; 154 obj2 = { prop1: 3, prop2: 4, 150: 'bar' };
155 assertTrue(%HaveSameMap(obj, obj2)); 155 assertTrue(%HaveSameMap(obj, obj2));
156 Object.preventExtensions(obj); 156 Object.preventExtensions(obj);
157 Object.preventExtensions(obj2); 157 Object.preventExtensions(obj2);
158 assertFalse(Object.isExtensible(obj)); 158 assertFalse(Object.isExtensible(obj));
159 assertFalse(Object.isExtensible(obj2)); 159 assertFalse(Object.isExtensible(obj2));
160 assertFalse(Object.isSealed(obj)); 160 assertFalse(Object.isSealed(obj));
161 assertFalse(Object.isSealed(obj2)); 161 assertFalse(Object.isSealed(obj2));
162 assertTrue(%HaveSameMap(obj, obj2)); 162 assertTrue(%HaveSameMap(obj, obj2));
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/reflect-prevent-extensions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698