diff options
author | Dwight <dmerriman@gmail.com> | 2009-02-06 14:06:38 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2009-02-06 14:06:38 -0500 |
commit | 3afb4cbb8c845b92c86befa8c95e341294bf8dfe (patch) | |
tree | 76139c1d524941e9ddd408fafc17aca0413eba4a /jstests/apitest_dbcollection.js | |
parent | 9e237c3871d56f14d6b302d1205bb9b8a9eaa834 (diff) | |
download | mongo-3afb4cbb8c845b92c86befa8c95e341294bf8dfe.tar.gz |
tweak asserts
Diffstat (limited to 'jstests/apitest_dbcollection.js')
-rw-r--r-- | jstests/apitest_dbcollection.js | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/jstests/apitest_dbcollection.js b/jstests/apitest_dbcollection.js index 00def92c426..80d5f8b9f1a 100644 --- a/jstests/apitest_dbcollection.js +++ b/jstests/apitest_dbcollection.js @@ -8,27 +8,27 @@ * test drop */ db.getCollection( "test_db" ).drop(); -assert(db.getCollection( "test_db" ).find().length() == 0); +assert(db.getCollection( "test_db" ).find().length() == 0,1); db.getCollection( "test_db" ).save({a:1}); -assert(db.getCollection( "test_db" ).find().length() == 1); +assert(db.getCollection( "test_db" ).find().length() == 1,2); db.getCollection( "test_db" ).drop(); -assert(db.getCollection( "test_db" ).find().length() == 0); +assert(db.getCollection( "test_db" ).find().length() == 0,3); /* * test count */ -assert(db.getCollection( "test_db" ).count() == 0); +assert(db.getCollection( "test_db" ).count() == 0,4); db.getCollection( "test_db" ).save({a:1}); -assert(db.getCollection( "test_db" ).count() == 1); +assert(db.getCollection( "test_db" ).count() == 1,5); for (i = 0; i < 100; i++) { db.getCollection( "test_db" ).save({a:1}); } -assert(db.getCollection( "test_db" ).count() == 101); +assert(db.getCollection( "test_db" ).count() == 101,6); db.getCollection( "test_db" ).drop(); -assert(db.getCollection( "test_db" ).count() == 0); +assert(db.getCollection( "test_db" ).count() == 0,7); /* * test clean (not sure... just be sure it doen't blow up, I guess @@ -41,26 +41,30 @@ assert(db.getCollection( "test_db" ).count() == 0); */ db.getCollection( "test_db" ).drop(); -assert(db.getCollection( "test_db" ).count() == 0); +assert(db.getCollection( "test_db" ).count() == 0,8); for (i = 0; i < 100; i++) { db.getCollection( "test_db" ).save({a:1}); } var v = db.getCollection( "test_db" ).validate(); -assert (v.ns == "test.test_db"); -assert (v.ok == 1); +if( v.ns != "test.test_db" ) { + print("Error: wrong ns name"); + print(tojson(v)); +} +assert (v.ns == "test.test_db",9); +assert (v.ok == 1,10); -assert(v.result.toString().match(/nrecords\?:(\d+)/)[1] == 100); +assert(v.result.toString().match(/nrecords\?:(\d+)/)[1] == 100,11); /* * test deleteIndex, deleteIndexes */ db.getCollection( "test_db" ).drop(); -assert(db.getCollection( "test_db" ).count() == 0); +assert(db.getCollection( "test_db" ).count() == 0,12); db.getCollection( "test_db" ).dropIndexes(); -assert(db.getCollection( "test_db" ).getIndexes().length() == 0); +assert(db.getCollection( "test_db" ).getIndexes().length() == 0,13); db.getCollection( "test_db" ).save({a:10}); db.getCollection( "test_db" ).ensureIndex({a:1}); |