summaryrefslogtreecommitdiff
path: root/jstests/core/objid4.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/objid4.js')
-rw-r--r--jstests/core/objid4.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/core/objid4.js b/jstests/core/objid4.js
new file mode 100644
index 00000000000..23986b95c71
--- /dev/null
+++ b/jstests/core/objid4.js
@@ -0,0 +1,16 @@
+
+
+
+o = new ObjectId();
+assert( o.str );
+
+a = new ObjectId( o.str );
+assert.eq( o.str , a.str );
+assert.eq( a.str , a.str.toString() )
+
+b = ObjectId( o.str );
+assert.eq( o.str , b.str );
+assert.eq( b.str , b.str.toString() )
+
+assert.throws( function(z){ return new ObjectId( "a" ); } );
+assert.throws( function(z){ return new ObjectId( "12345678901234567890123z" ); } );