diff options
author | Mike Grundy <michael.grundy@10gen.com> | 2016-03-17 14:41:31 -0400 |
---|---|---|
committer | Mike Grundy <michael.grundy@10gen.com> | 2016-03-18 17:10:31 -0400 |
commit | 1be713cebbb9411d2977ec9996931a4508252af0 (patch) | |
tree | a199db2a273ebb5ca4289158ee5f63066cb3926a /jstests/core | |
parent | d82956a6fe2e7d5dd6216e66e95900d73dbf2e0c (diff) | |
download | mongo-1be713cebbb9411d2977ec9996931a4508252af0.tar.gz |
SERVER-23067 Final round of JS linting and formatting
Diffstat (limited to 'jstests/core')
-rw-r--r-- | jstests/core/bulk_insert_capped.js | 4 | ||||
-rw-r--r-- | jstests/core/capped5.js | 2 | ||||
-rw-r--r-- | jstests/core/counta.js | 38 | ||||
-rw-r--r-- | jstests/core/countc.js | 6 | ||||
-rw-r--r-- | jstests/core/drop3.js | 2 | ||||
-rw-r--r-- | jstests/core/existsa.js | 2 | ||||
-rw-r--r-- | jstests/core/explain_distinct.js | 8 | ||||
-rw-r--r-- | jstests/core/geo_center_sphere2.js | 2 | ||||
-rw-r--r-- | jstests/core/geo_polygon1.js | 4 | ||||
-rw-r--r-- | jstests/core/geo_polygon1_noindex.js | 4 | ||||
-rw-r--r-- | jstests/core/geo_polygon3.js | 4 | ||||
-rw-r--r-- | jstests/core/index_bigkeys_update.js | 2 | ||||
-rw-r--r-- | jstests/core/index_plugins.js | 10 | ||||
-rw-r--r-- | jstests/core/indexp.js | 2 | ||||
-rw-r--r-- | jstests/core/max_time_ms.js | 6 | ||||
-rw-r--r-- | jstests/core/mr_killop.js | 12 | ||||
-rw-r--r-- | jstests/core/regex5.js | 18 | ||||
-rw-r--r-- | jstests/core/rename.js | 2 |
18 files changed, 64 insertions, 64 deletions
diff --git a/jstests/core/bulk_insert_capped.js b/jstests/core/bulk_insert_capped.js index 129c393dbfb..b7d21cee3f5 100644 --- a/jstests/core/bulk_insert_capped.js +++ b/jstests/core/bulk_insert_capped.js @@ -15,9 +15,9 @@ assert(res.valid, tojson(res)); // Ensure that various ways of iterating the collection only return one document. - assert.eq(t.find().itcount(), 1); // Table scan. + assert.eq(t.find().itcount(), 1); // Table scan. assert.eq(t.find({}, {_id: 1}).hint({_id: 1}).itcount(), 1); // Index only (covered). - assert.eq(t.find().hint({_id: 1}).itcount(), 1); // Index scan with fetch. + assert.eq(t.find().hint({_id: 1}).itcount(), 1); // Index scan with fetch. // Ensure that the second document is the one that is kept. assert.eq(t.findOne(), {_id: 2}); diff --git a/jstests/core/capped5.js b/jstests/core/capped5.js index 33d78c5e17f..930cbabb462 100644 --- a/jstests/core/capped5.js +++ b/jstests/core/capped5.js @@ -19,7 +19,7 @@ t.drop(); db.createCollection(tn, {capped: true, size: 1024 * 1024 * 1}); t.insert({_id: 5, x: 11}); t.insert({_id: 5, x: 12}); -assert.eq(1, t.getIndexes().length); // now we assume _id index +assert.eq(1, t.getIndexes().length); // now we assume _id index assert.eq(1, t.find().toArray().length); //_id index unique, so second insert fails t.drop(); diff --git a/jstests/core/counta.js b/jstests/core/counta.js index 0762769a088..26ce4d2269e 100644 --- a/jstests/core/counta.js +++ b/jstests/core/counta.js @@ -1,29 +1,29 @@ // Check that count returns 0 in some exception cases. (function() { -'use strict'; + 'use strict'; -var t = db.jstests_counta; -t.drop(); + var t = db.jstests_counta; + t.drop(); -for (var i = 0; i < 10; ++i) { - t.save({a: i}); -} + for (var i = 0; i < 10; ++i) { + t.save({a: i}); + } -// f() is undefined, causing an assertion -assert.throws(function() { - t.count({ - $where: function() { - if (this.a < 5) { - return true; - } else { - f(); + // f() is undefined, causing an assertion + assert.throws(function() { + t.count({ + $where: function() { + if (this.a < 5) { + return true; + } else { + f(); + } } - } + }); }); -}); -// count must return error if collection name is absent -var res = assert.commandFailed(db.runCommand("count")); -assert.eq(ErrorCodes.InvalidNamespace, res.code); + // count must return error if collection name is absent + var res = assert.commandFailed(db.runCommand("count")); + assert.eq(ErrorCodes.InvalidNamespace, res.code); })(); diff --git a/jstests/core/countc.js b/jstests/core/countc.js index ea4aed54903..39a297ec8c4 100644 --- a/jstests/core/countc.js +++ b/jstests/core/countc.js @@ -28,7 +28,7 @@ assert.eq(2, t.count({a: {$in: vals}})); t.drop(); t.ensureIndex({a: 1}); t.save({a: [1, 2]}); // Will match because 'a' is in range. -t.save({a: 9}); // Will not match because 'a' is not in range. +t.save({a: 9}); // Will not match because 'a' is not in range. // Only one document matches. assert.eq(1, t.count({a: {$gt: 0, $lt: 5}})); @@ -43,7 +43,7 @@ assert.eq(0, t.count({'a.b': 2, 'a.c': 2})); t.drop(); t.ensureIndex({a: 1}); t.save({a: 'a'}); // Will match. -t.save({a: {}}); // Will not match because {} is not a string. +t.save({a: {}}); // Will not match because {} is not a string. // Only one document matches. assert.eq(1, t.count({a: {$gte: ''}})); @@ -51,7 +51,7 @@ assert.eq(1, t.count({a: {$gte: ''}})); t.drop(); t.ensureIndex({a: 1}); t.save({a: new Date(1)}); // Will match. -t.save({a: true}); // Will not match because 'true' is not a date. +t.save({a: true}); // Will not match because 'true' is not a date. // Only one document matches. assert.eq(1, t.count({a: {$lte: new Date(1)}})); diff --git a/jstests/core/drop3.js b/jstests/core/drop3.js index 1215d218e4f..a3807faab12 100644 --- a/jstests/core/drop3.js +++ b/jstests/core/drop3.js @@ -21,5 +21,5 @@ t.drop(); // should invalidate cursor, but not subcursor assert.throws(function() { cursor.itcount(); -}); // throws "cursor doesn't exist on server" error on getMore +}); // throws "cursor doesn't exist on server" error on getMore assert.eq(subcursor.itcount(), 9); // one already seen diff --git a/jstests/core/existsa.js b/jstests/core/existsa.js index 466a5e94a63..45adb5d3172 100644 --- a/jstests/core/existsa.js +++ b/jstests/core/existsa.js @@ -85,7 +85,7 @@ assertExistsUnindexed({a: {$not: {$exists: false}}}); // Nested $exists queries disallow the sparse index in some cases where it is not strictly // necessary to do so. (Descriptive tests.) assertExistsUnindexed({$nor: [{b: {$exists: false}}]}, 1); // Unindexed field. -assertExists({$or: [{a: {$exists: true}}]}); // $exists:true not $exists:false. +assertExists({$or: [{a: {$exists: true}}]}); // $exists:true not $exists:false. // Behavior is similar with $elemMatch. t.drop(); diff --git a/jstests/core/explain_distinct.js b/jstests/core/explain_distinct.js index 37d5a485516..bc5b3635c95 100644 --- a/jstests/core/explain_distinct.js +++ b/jstests/core/explain_distinct.js @@ -35,10 +35,10 @@ assert.writeOK(coll.insert({a: 2, c: 1})); } - assert.commandFailed(runDistinctExplain(coll, {}, {})); // Bad keyString. - assert.commandFailed(runDistinctExplain(coll, 'a', 'a')); // Bad query. - assert.commandFailed(runDistinctExplain(coll, 'b', {$not: 1})); // Bad query. - assert.commandFailed(runDistinctExplain(coll, 'a', {$not: 1})); // Bad query. + assert.commandFailed(runDistinctExplain(coll, {}, {})); // Bad keyString. + assert.commandFailed(runDistinctExplain(coll, 'a', 'a')); // Bad query. + assert.commandFailed(runDistinctExplain(coll, 'b', {$not: 1})); // Bad query. + assert.commandFailed(runDistinctExplain(coll, 'a', {$not: 1})); // Bad query. assert.commandFailed(runDistinctExplain(coll, '_id', {$not: 1})); // Bad query. // Ensure that server accepts a distinct command with no 'query' field. diff --git a/jstests/core/geo_center_sphere2.js b/jstests/core/geo_center_sphere2.js index ac8f09cbe77..f3dc465e350 100644 --- a/jstests/core/geo_center_sphere2.js +++ b/jstests/core/geo_center_sphere2.js @@ -31,7 +31,7 @@ for (var test = 0; test < numTests; test++) { Random.srand(1337 + test); var radius = 5000 * Random.rand(); // km - radius = radius / 6378.1; // radians; earth radius from geoconstants.h + radius = radius / 6378.1; // radians; earth radius from geoconstants.h var numDocs = Math.floor(400 * Random.rand()); // TODO: Wrapping uses the error value to figure out what would overlap... var bits = Math.floor(5 + Random.rand() * 28); diff --git a/jstests/core/geo_polygon1.js b/jstests/core/geo_polygon1.js index 487df91a167..d1dbf0c19dc 100644 --- a/jstests/core/geo_polygon1.js +++ b/jstests/core/geo_polygon1.js @@ -58,8 +58,8 @@ assert.commandWorked(t.ensureIndex({loc: "2d"})); assert.eq(1, t.find({loc: {$within: {$polygon: pacman}}}).count(), "Pacman single point"); -t.save({loc: [5, 3]}); // Add a point that's out right in the mouth opening -t.save({loc: [3, 7]}); // Add a point above the center of the head +t.save({loc: [5, 3]}); // Add a point that's out right in the mouth opening +t.save({loc: [3, 7]}); // Add a point above the center of the head t.save({loc: [3, -1]}); // Add a point below the center of the bottom assert.eq(1, t.find({loc: {$within: {$polygon: pacman}}}).count(), "Pacman double point"); diff --git a/jstests/core/geo_polygon1_noindex.js b/jstests/core/geo_polygon1_noindex.js index 672f53ebd90..22f90e7157c 100644 --- a/jstests/core/geo_polygon1_noindex.js +++ b/jstests/core/geo_polygon1_noindex.js @@ -53,8 +53,8 @@ assert.writeOK(t.save({loc: [1, 3]})); // Add a point that's in assert.eq(1, t.find({loc: {$within: {$polygon: pacman}}}).count(), "Pacman single point"); -t.save({loc: [5, 3]}); // Add a point that's out right in the mouth opening -t.save({loc: [3, 7]}); // Add a point above the center of the head +t.save({loc: [5, 3]}); // Add a point that's out right in the mouth opening +t.save({loc: [3, 7]}); // Add a point above the center of the head t.save({loc: [3, -1]}); // Add a point below the center of the bottom assert.eq(1, t.find({loc: {$within: {$polygon: pacman}}}).count(), "Pacman double point"); diff --git a/jstests/core/geo_polygon3.js b/jstests/core/geo_polygon3.js index 887e81701cd..ed8f040fa8d 100644 --- a/jstests/core/geo_polygon3.js +++ b/jstests/core/geo_polygon3.js @@ -56,8 +56,8 @@ for (var n = 0; n < numTests; n++) { assert.eq(1, t.find({loc: {$within: {$polygon: pacman}}}).itcount(), "Pacman single point"); - t.save({loc: [5, 3]}); // Add a point that's out right in the mouth opening - t.save({loc: [3, 7]}); // Add a point above the center of the head + t.save({loc: [5, 3]}); // Add a point that's out right in the mouth opening + t.save({loc: [3, 7]}); // Add a point above the center of the head t.save({loc: [3, -1]}); // Add a point below the center of the bottom assert.eq(1, t.find({loc: {$within: {$polygon: pacman}}}).itcount(), "Pacman double point"); diff --git a/jstests/core/index_bigkeys_update.js b/jstests/core/index_bigkeys_update.js index a3074bfdfdd..73be9c77b94 100644 --- a/jstests/core/index_bigkeys_update.js +++ b/jstests/core/index_bigkeys_update.js @@ -14,5 +14,5 @@ assert.eq(1, t.count()); assert.writeError(t.update({}, {$set: {x: bigString}})); assert.eq(1, t.count()); -assert.eq("asd", t.findOne().x); // make sure doc is the old version +assert.eq("asd", t.findOne().x); // make sure doc is the old version assert.eq("asd", t.findOne({_id: 0}).x); // make sure doc is the old version diff --git a/jstests/core/index_plugins.js b/jstests/core/index_plugins.js index f32e1e4345a..0ec565d1d50 100644 --- a/jstests/core/index_plugins.js +++ b/jstests/core/index_plugins.js @@ -46,7 +46,7 @@ coll.dropIndexes(); assert.commandWorked(coll.ensureIndex({a: "text", b: "text"})); coll.dropIndexes(); -assert.commandFailed(coll.ensureIndex({a: "2d", b: "2d"})); // unsupported +assert.commandFailed(coll.ensureIndex({a: "2d", b: "2d"})); // unsupported assert.commandFailed(coll.ensureIndex({a: "geoHaystack", b: "geoHaystack"}, // unsupported {bucketSize: 1})); @@ -54,9 +54,9 @@ assert.commandFailed(coll.ensureIndex({a: "hashed", b: "hashed"})); // unsuppor // Test compounding different special index types with each other. -assert.commandFailed(coll.ensureIndex({a: "2d", b: "hashed"})); // unsupported -assert.commandFailed(coll.ensureIndex({a: "hashed", b: "2dsphere"})); // unsupported -assert.commandFailed(coll.ensureIndex({a: "2dsphere", b: "text"})); // unsupported +assert.commandFailed(coll.ensureIndex({a: "2d", b: "hashed"})); // unsupported +assert.commandFailed(coll.ensureIndex({a: "hashed", b: "2dsphere"})); // unsupported +assert.commandFailed(coll.ensureIndex({a: "2dsphere", b: "text"})); // unsupported assert.commandFailed(coll.ensureIndex({a: "text", b: "geoHaystack"})); // unsupported -assert.commandFailed(coll.ensureIndex({a: "geoHaystack", b: "2d"}, // unsupported +assert.commandFailed(coll.ensureIndex({a: "geoHaystack", b: "2d"}, // unsupported {bucketSize: 1})); diff --git a/jstests/core/indexp.js b/jstests/core/indexp.js index 0111f0cca35..71e9f8eadb9 100644 --- a/jstests/core/indexp.js +++ b/jstests/core/indexp.js @@ -17,7 +17,7 @@ assert.commandWorked(coll.ensureIndex({'a.b': 1})); assert.commandFailed(coll.ensureIndex({'$a': 1})); assert.commandFailed(coll.ensureIndex({'a.$b': 1})); assert.commandFailed(coll.ensureIndex({'$db': 1})); -assert.commandWorked(coll.ensureIndex({'a$ap': 1})); // $ in middle is ok +assert.commandWorked(coll.ensureIndex({'a$ap': 1})); // $ in middle is ok assert.commandWorked(coll.ensureIndex({'a.$id': 1})); // $id/$db/$ref are execptions coll.dropIndexes(); diff --git a/jstests/core/max_time_ms.js b/jstests/core/max_time_ms.js index e70ae8cb0fe..7762c8a439c 100644 --- a/jstests/core/max_time_ms.js +++ b/jstests/core/max_time_ms.js @@ -48,7 +48,7 @@ assert.doesNotThrow(function() { // t.drop(); -t.insert([{}, {}, {}]); // fast batch +t.insert([{}, {}, {}]); // fast batch t.insert([{slow: true}, {slow: true}, {slow: true}]); // slow batch cursor = t.find({ $where: function() { @@ -79,7 +79,7 @@ assert.throws(function() { // t.drop(); -t.insert([{}, {}, {}]); // fast batch +t.insert([{}, {}, {}]); // fast batch t.insert([{}, {}, {slow: true}]); // slow batch cursor = t.find({ $where: function() { @@ -348,7 +348,7 @@ assert.eq(1, t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut", // maxTimeNeverTimeOut positive test for getmore. t.drop(); -t.insert([{}, {}, {}]); // fast batch +t.insert([{}, {}, {}]); // fast batch t.insert([{slow: true}, {slow: true}, {slow: true}]); // slow batch cursor = t.find({ $where: function() { diff --git a/jstests/core/mr_killop.js b/jstests/core/mr_killop.js index c4d8b666f11..52865eacbe4 100644 --- a/jstests/core/mr_killop.js +++ b/jstests/core/mr_killop.js @@ -111,7 +111,7 @@ function runMRTests(loop, childLoop) { test(loop, // map function(k, v) { return v[0]; - }, // reduce + }, // reduce null, // finalize null, // scope childLoop); @@ -120,7 +120,7 @@ function runMRTests(loop, childLoop) { test( function() { emit(this.a, 1); - }, // map + }, // map loop, // reduce null, // finalize null, // scope @@ -133,8 +133,8 @@ function runMRTests(loop, childLoop) { }, // map function(k, v) { return v[0]; - }, // reduce - null, // finalize + }, // reduce + null, // finalize {loop: loop}, // scope childLoop); } @@ -148,7 +148,7 @@ function runFinalizeTests(loop, childLoop) { }, // map function(k, v) { return v[0]; - }, // reduce + }, // reduce loop, // finalize null, // scope childLoop); @@ -163,7 +163,7 @@ function runFinalizeTests(loop, childLoop) { }, // reduce function(a, b) { loop(); - }, // finalize + }, // finalize {loop: loop}, // scope childLoop); } diff --git a/jstests/core/regex5.js b/jstests/core/regex5.js index 36274f8b3ca..6d11fce5578 100644 --- a/jstests/core/regex5.js +++ b/jstests/core/regex5.js @@ -18,17 +18,17 @@ doit = function() { assert.eq(1, t.find({x: a}).count(), "A"); assert.eq(2, t.find({x: x}).count(), "B"); - assert.eq(2, t.find({x: {$in: [x]}}).count(), "C"); // SERVER-322 - assert.eq(1, t.find({x: {$in: [a, "xyz1"]}}).count(), "D"); // SERVER-322 - assert.eq(2, t.find({x: {$in: [a, "xyz2"]}}).count(), "E"); // SERVER-322 - assert.eq(1, t.find({x: {$all: [a, x]}}).count(), "F"); // SERVER-505 - assert.eq(1, t.find({x: {$all: [a, "abc"]}}).count(), "G"); // SERVER-505 - assert.eq(0, t.find({x: {$all: [a, "ac"]}}).count(), "H"); // SERVER-505 - assert.eq(10, t.find({x: {$nin: [x]}}).count(), "I"); // SERVER-322 + assert.eq(2, t.find({x: {$in: [x]}}).count(), "C"); // SERVER-322 + assert.eq(1, t.find({x: {$in: [a, "xyz1"]}}).count(), "D"); // SERVER-322 + assert.eq(2, t.find({x: {$in: [a, "xyz2"]}}).count(), "E"); // SERVER-322 + assert.eq(1, t.find({x: {$all: [a, x]}}).count(), "F"); // SERVER-505 + assert.eq(1, t.find({x: {$all: [a, "abc"]}}).count(), "G"); // SERVER-505 + assert.eq(0, t.find({x: {$all: [a, "ac"]}}).count(), "H"); // SERVER-505 + assert.eq(10, t.find({x: {$nin: [x]}}).count(), "I"); // SERVER-322 assert.eq(11, t.find({x: {$nin: [a, "xyz1"]}}).count(), "J"); // SERVER-322 assert.eq(10, t.find({x: {$nin: [a, "xyz2"]}}).count(), "K"); // SERVER-322 - assert.eq(2, t.find({x: {$not: {$nin: [x]}}}).count(), "L"); // SERVER-322 - assert.eq(11, t.find({x: {$nin: [/^a.c/]}}).count(), "M"); // SERVER-322 + assert.eq(2, t.find({x: {$not: {$nin: [x]}}}).count(), "L"); // SERVER-322 + assert.eq(11, t.find({x: {$nin: [/^a.c/]}}).count(), "M"); // SERVER-322 }; doit(); diff --git a/jstests/core/rename.js b/jstests/core/rename.js index 3287159f850..e9646091877 100644 --- a/jstests/core/rename.js +++ b/jstests/core/rename.js @@ -53,7 +53,7 @@ printjson(b.stats()); // while (res.hasNext()) printjson(res.next()); assert.eq(1, b.count({i: i - 1})); // make sure last is there -assert.eq(0, b.count({i: 9.1})); // make sure early one is gone +assert.eq(0, b.count({i: 9.1})); // make sure early one is gone assert(db.getCollectionNames().indexOf("jstests_rename_b") >= 0); assert(db.getCollectionNames().indexOf("jstests_rename_a") < 0); |