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

Side by Side Diff: test/mjsunit/object-seal.js

Issue 7053035: Fix a number of tests that incorrectly used assertUnreachable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/object-literal.js ('k') | test/mjsunit/property-load-across-eval.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 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 14 matching lines...) Expand all
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Tests the Object.seal and Object.isSealed methods - ES 15.2.3.9 and 28 // Tests the Object.seal and Object.isSealed methods - ES 15.2.3.9 and
29 // ES 15.2.3.12 29 // ES 15.2.3.12
30 30
31 31
32 // Test that we throw an error if an object is not passed as argument. 32 // Test that we throw an error if an object is not passed as argument.
33 var non_objects = new Array(undefined, null, 1, -1, 0, 42.43); 33 var non_objects = new Array(undefined, null, 1, -1, 0, 42.43);
34 for (var key in non_objects) { 34 for (var key in non_objects) {
35 var exception = false;
35 try { 36 try {
36 Object.seal(non_objects[key]); 37 Object.seal(non_objects[key]);
37 assertUnreachable();
38 } catch(e) { 38 } catch(e) {
39 exception = true;
39 assertTrue(/Object.seal called on non-object/.test(e)); 40 assertTrue(/Object.seal called on non-object/.test(e));
40 } 41 }
42 assertTrue(exception);
41 } 43 }
42 44
43 for (var key in non_objects) { 45 for (var key in non_objects) {
46 exception = false;
44 try { 47 try {
45 Object.isSealed(non_objects[key]); 48 Object.isSealed(non_objects[key]);
46 assertUnreachable();
47 } catch(e) { 49 } catch(e) {
50 exception = true;
48 assertTrue(/Object.isSealed called on non-object/.test(e)); 51 assertTrue(/Object.isSealed called on non-object/.test(e));
49 } 52 }
53 assertTrue(exception);
50 } 54 }
51 55
52 // Test normal data properties. 56 // Test normal data properties.
53 var obj = { x: 42, z: 'foobar' }; 57 var obj = { x: 42, z: 'foobar' };
54 var desc = Object.getOwnPropertyDescriptor(obj, 'x'); 58 var desc = Object.getOwnPropertyDescriptor(obj, 'x');
55 assertTrue(desc.writable); 59 assertTrue(desc.writable);
56 assertTrue(desc.configurable); 60 assertTrue(desc.configurable);
57 assertEquals(42, desc.value); 61 assertEquals(42, desc.value);
58 62
59 desc = Object.getOwnPropertyDescriptor(obj, 'z'); 63 desc = Object.getOwnPropertyDescriptor(obj, 'z');
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 var obj4 = {}; 185 var obj4 = {};
182 Object.defineProperty(obj4, 'x', {configurable: true, writable: false}); 186 Object.defineProperty(obj4, 'x', {configurable: true, writable: false});
183 Object.defineProperty(obj4, 'y', {configurable: false, writable: false}); 187 Object.defineProperty(obj4, 'y', {configurable: false, writable: false});
184 Object.preventExtensions(obj4); 188 Object.preventExtensions(obj4);
185 189
186 assertFalse(Object.isSealed(obj4)); 190 assertFalse(Object.isSealed(obj4));
187 191
188 // Make sure that Object.seal returns the sealed object. 192 // Make sure that Object.seal returns the sealed object.
189 var obj4 = {}; 193 var obj4 = {};
190 assertTrue(obj4 === Object.seal(obj4)); 194 assertTrue(obj4 === Object.seal(obj4));
OLDNEW
« no previous file with comments | « test/mjsunit/object-literal.js ('k') | test/mjsunit/property-load-across-eval.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698