Browse files

forgot to commit test for SERVER-487

  • Loading branch information...
1 parent a7f5b11 commit 6df2dd965ee1ba576522096e67c2e1f773a669e9 @erh erh committed Dec 28, 2009
Showing with 25 additions and 0 deletions.
  1. +25 −0 jstests/rename3.js
View
25 jstests/rename3.js
@@ -0,0 +1,25 @@
+
+
+a = db.rename3a
+b = db.rename3b
+
+a.drop();
+b.drop()
+
+a.save( { x : 1 } );
+b.save( { x : 2 } );
+
+assert.eq( 1 , a.findOne().x , "before 1a" );
+assert.eq( 2 , b.findOne().x , "before 2a" );
+
+res = b.renameCollection( a._shortName );
+assert.eq( 0 , res.ok , "should fail: " + tojson( res ) );
+
+assert.eq( 1 , a.findOne().x , "before 1b" );
+assert.eq( 2 , b.findOne().x , "before 2b" );
+
+res = b.renameCollection( a._shortName , true )
+assert.eq( 1 , res.ok , "should succeed:" + tojson( res ) );
+
+assert.eq( 2 , a.findOne().x , "after 1" );
+assert.isnull( b.findOne() , "after 2" );

0 comments on commit 6df2dd9

Please sign in to comment.