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

Unified Diff: test/mjsunit/array-iteration.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/array-indexing.js ('k') | test/mjsunit/array-reduce.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/array-iteration.js
diff --git a/test/mjsunit/array-iteration.js b/test/mjsunit/array-iteration.js
index 0ee2e6e9ac3925d8b67c464f45a53d4959578616..3e847f685f1badc6e914b3a834ab6d96a7bf2521 100644
--- a/test/mjsunit/array-iteration.js
+++ b/test/mjsunit/array-iteration.js
@@ -43,19 +43,26 @@
assertArrayEquals(a, a);
// Use specified object as this object when calling the function.
- var o = { value: 42 }
+ var o = { value: 42 };
a = [1,42,3,42,4];
- assertArrayEquals([42,42], a.filter(function(n) { return this.value == n }, o))
+ assertArrayEquals([42,42],
+ a.filter(function(n) { return this.value == n; }, o));
// Modify original array.
a = [1,42,3,42,4];
- assertArrayEquals([42,42], a.filter(function(n, index, array) { array[index] = 43; return 42 == n; }));
+ assertArrayEquals([42,42], a.filter(function(n, index, array) {
+ array[index] = 43;
+ return 42 == n;
+ }));
assertArrayEquals([43,43,43,43,43], a);
// Only loop through initial part of array eventhough elements are
// added.
a = [1,1];
- assertArrayEquals([], a.filter(function(n, index, array) { array.push(n+1); return n == 2; }));
+ assertArrayEquals([], a.filter(function(n, index, array) {
+ array.push(n+1);
+ return n == 2;
+ }));
assertArrayEquals([1,1,2,2], a);
// Respect holes.
@@ -82,7 +89,7 @@
assertEquals(2, count);
// Use specified object as this object when calling the function.
- var o = { value: 42 }
+ var o = { value: 42 };
var result = [];
a.forEach(function(n) { result.push(this.value); }, o);
assertArrayEquals([42,42], result);
@@ -118,13 +125,13 @@
(function() {
// Simple use.
var a = [0,1];
- assertFalse(a.every(function(n) { return n == 0 }));
+ assertFalse(a.every(function(n) { return n == 0; }));
a = [0,0];
- assertTrue(a.every(function(n) { return n == 0 }));
- assertTrue([].every(function(n) { return n == 0}));
+ assertTrue(a.every(function(n) { return n == 0; }));
+ assertTrue([].every(function(n) { return n == 0; }));
// Use specified object as this object when calling the function.
- var o = { value: 42 }
+ var o = { value: 42 };
a = [0];
assertFalse(a.every(function(n) { return this.value == n; }, o));
a = [42];
@@ -163,21 +170,25 @@
assertEquals(a, a);
// Use specified object as this object when calling the function.
- var o = { delta: 42 }
+ var o = { delta: 42 };
result = [42,43,44,45,46];
assertArrayEquals(result, a.map(function(n) { return this.delta + n; }, o));
// Modify original array.
a = [0,1,2,3,4];
result = [1,2,3,4,5];
- assertArrayEquals(result, a.map(function(n, index, array) { array[index] = n + 1; return n + 1;}));
+ assertArrayEquals(result, a.map(
+ function(n, index, array) { array[index] = n + 1; return n + 1;}));
assertArrayEquals(result, a);
// Only loop through initial part of array eventhough elements are
// added.
a = [0,1,2,3,4];
result = [1,2,3,4,5];
- assertArrayEquals(result, a.map(function(n, index, array) { array.push(n); return n + 1;}));
+ assertArrayEquals(result, a.map(function(n, index, array) {
+ array.push(n);
+ return n + 1;
+ }));
assertArrayEquals([0,1,2,3,4,0,1,2,3,4], a);
// Respect holes.
@@ -195,8 +206,8 @@
var a = [0,1,2,3,4];
// Simple use.
- assertTrue(a.some(function(n) { return n == 3}));
- assertFalse(a.some(function(n) { return n == 5}));
+ assertTrue(a.some(function(n) { return n == 3; }));
+ assertFalse(a.some(function(n) { return n == 5; }));
// Use specified object as this object when calling the function.
var o = { element: 42 };
@@ -207,12 +218,18 @@
// Modify original array.
a = [0,1,2,3];
- assertTrue(a.some(function(n, index, array) { array[index] = n + 1; return n == 2; }));
+ assertTrue(a.some(function(n, index, array) {
+ array[index] = n + 1;
+ return n == 2;
+ }));
assertArrayEquals([1,2,3,3], a);
// Only loop through initial part when elements are added.
a = [0,1,2];
- assertFalse(a.some(function(n, index, array) { array.push(42); return n == 42; }));
+ assertFalse(a.some(function(n, index, array) {
+ array.push(42);
+ return n == 42;
+ }));
assertArrayEquals([0,1,2,42,42,42], a);
// Respect holes.
@@ -225,4 +242,3 @@
assertEquals(2, count);
})();
-
« no previous file with comments | « test/mjsunit/array-indexing.js ('k') | test/mjsunit/array-reduce.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698