diff options
Diffstat (limited to 'jstests/core/counta.js')
-rw-r--r-- | jstests/core/counta.js | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/jstests/core/counta.js b/jstests/core/counta.js index eadec40f4a1..c65df230c72 100644 --- a/jstests/core/counta.js +++ b/jstests/core/counta.js @@ -3,17 +3,24 @@ t = db.jstests_counta; t.drop(); -for( i = 0; i < 10; ++i ) { - t.save( {a:i} ); +for (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 -res=db.runCommand("count"); -assert.eq(res.ok, 0); // must not be OK -assert(res.code == 2); // should fail with errorcode("BadValue"), not an massert +res = db.runCommand("count"); +assert.eq(res.ok, 0); // must not be OK +assert(res.code == 2); // should fail with errorcode("BadValue"), not an massert |