summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-08-24 10:21:34 -0400
committerEliot Horowitz <eliot@10gen.com>2009-08-24 10:21:34 -0400
commit42504fc904b751ba30948a38601e26bc95f5146c (patch)
tree5d2c5fd3747695dc78d647c3b2aad98dbc9c090c
parentfd2155d554acbe12da09c525be1da108ab1dcbfc (diff)
downloadmongo-42504fc904b751ba30948a38601e26bc95f5146c.tar.gz
make assert.soon take a string to eval
-rw-r--r--shell/utils.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/shell/utils.js b/shell/utils.js
index 7c1ce2fc7c2..f7597278e4b 100644
--- a/shell/utils.js
+++ b/shell/utils.js
@@ -45,8 +45,16 @@ assert.soon = function( f, msg, timeout, interval ) {
interval = interval || 200;
var last;
while( 1 ) {
- if ( f() )
- return;
+
+ if ( typeof( f ) == "string" ){
+ if ( eval( f ) )
+ return;
+ }
+ else {
+ if ( f() )
+ return;
+ }
+
if ( ( new Date() ).getTime() - start.getTime() > timeout )
doassert( "assert.soon failed: " + f + ", msg:" + msg );
sleep( interval );