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

Side by Side Diff: test/mjsunit/instanceof.js

Issue 7826007: Added check for trailing whitespaces and corrected existing violations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Yet another iteration. Created 9 years, 3 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/in.js ('k') | test/mjsunit/keyed-storage-extend.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 assertFalse(C instanceof F); 53 assertFalse(C instanceof F);
54 assertFalse(B instanceof F); 54 assertFalse(B instanceof F);
55 assertFalse(A instanceof F); 55 assertFalse(A instanceof F);
56 } 56 }
57 57
58 TestChains(); 58 TestChains();
59 59
60 60
61 function TestExceptions() { 61 function TestExceptions() {
62 function F() { } 62 function F() { }
63 var items = [ 1, new Number(42), 63 var items = [ 1, new Number(42),
64 true, 64 true,
65 'string', new String('hest'), 65 'string', new String('hest'),
66 {}, [], 66 {}, [],
67 F, new F(), 67 F, new F(),
68 Object, String ]; 68 Object, String ];
69 69
70 var exceptions = 0; 70 var exceptions = 0;
71 var instanceofs = 0; 71 var instanceofs = 0;
72 72
73 for (var i = 0; i < items.length; i++) { 73 for (var i = 0; i < items.length; i++) {
74 for (var j = 0; j < items.length; j++) { 74 for (var j = 0; j < items.length; j++) {
75 try { 75 try {
76 if (items[i] instanceof items[j]) instanceofs++; 76 if (items[i] instanceof items[j]) instanceofs++;
77 } catch (e) { 77 } catch (e) {
78 assertTrue(e instanceof TypeError); 78 assertTrue(e instanceof TypeError);
79 exceptions++; 79 exceptions++;
80 } 80 }
81 } 81 }
82 } 82 }
83 assertEquals(10, instanceofs); 83 assertEquals(10, instanceofs);
84 assertEquals(88, exceptions); 84 assertEquals(88, exceptions);
85 85
86 // Make sure to throw an exception if the function prototype 86 // Make sure to throw an exception if the function prototype
87 // isn't a proper JavaScript object. 87 // isn't a proper JavaScript object.
88 function G() { } 88 function G() { }
89 G.prototype = undefined; 89 G.prototype = undefined;
90 assertThrows("({} instanceof G)"); 90 assertThrows("({} instanceof G)");
91 } 91 }
92 92
93 TestExceptions(); 93 TestExceptions();
OLDNEW
« no previous file with comments | « test/mjsunit/in.js ('k') | test/mjsunit/keyed-storage-extend.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698