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

Side by Side Diff: test/mjsunit/array-slice.js

Issue 8888006: Make more JS files beter match the coding standard. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 9 years 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/array-reduce.js ('k') | test/mjsunit/array-sort.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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } catch (e) { 100 } catch (e) {
101 assertEquals('Exception', e); 101 assertEquals('Exception', e);
102 } 102 }
103 } 103 }
104 })(); 104 })();
105 105
106 106
107 // Nasty: modify the array in ToInteger. 107 // Nasty: modify the array in ToInteger.
108 (function() { 108 (function() {
109 var array = []; 109 var array = [];
110 var expected = [] 110 var expected = [];
111 bad_guy = { valueOf: function() { array.push(array.length); return -1; } }; 111 bad_guy = { valueOf: function() { array.push(array.length); return -1; } };
112 112
113 for (var i = 0; i < 13; i++) { 113 for (var i = 0; i < 13; i++) {
114 var sliced = array.slice(bad_guy); 114 var sliced = array.slice(bad_guy);
115 expected.push(i); 115 expected.push(i);
116 assertEquals(expected, array); 116 assertEquals(expected, array);
117 // According to the spec (15.4.4.10), length is calculated before 117 // According to the spec (15.4.4.10), length is calculated before
118 // performing ToInteger on arguments. 118 // performing ToInteger on arguments.
119 if (i == 0) { 119 if (i == 0) {
120 assertEquals([], sliced); // Length was 0, nothing to get. 120 assertEquals([], sliced); // Length was 0, nothing to get.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // Check slicing on arguments object when argument has been deleted by index. 283 // Check slicing on arguments object when argument has been deleted by index.
284 (function() { 284 (function() {
285 function func(x, y, z) { 285 function func(x, y, z) {
286 assertEquals(3, arguments.length); 286 assertEquals(3, arguments.length);
287 delete arguments[1]; 287 delete arguments[1];
288 assertEquals([x,,z], Array.prototype.slice.call(arguments, 0)); 288 assertEquals([x,,z], Array.prototype.slice.call(arguments, 0));
289 } 289 }
290 290
291 func('a', 'b', 'c'); 291 func('a', 'b', 'c');
292 })(); 292 })();
OLDNEW
« no previous file with comments | « test/mjsunit/array-reduce.js ('k') | test/mjsunit/array-sort.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698