diff options
Diffstat (limited to 'jstests/core/query/type/type4.js')
-rw-r--r-- | jstests/core/query/type/type4.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/jstests/core/query/type/type4.js b/jstests/core/query/type/type4.js new file mode 100644 index 00000000000..c7e11110618 --- /dev/null +++ b/jstests/core/query/type/type4.js @@ -0,0 +1,29 @@ +(function() { +"use strict"; + +// Tests for SERVER-20080 +// +// Verify that various types cannot be invoked as constructors + +var t = db.jstests_type4; +t.drop(); +t.insert({}); +t.insert({}); +t.insert({}); + +assert.throws(function() { + (new _rand())(); +}, [], "invoke constructor on natively injected function"); + +assert.throws(function() { + var doc = db.test.findOne(); + new doc(); +}, [], "invoke constructor on BSON"); + +assert.throws(function() { + var cursor = t.find(); + cursor.next(); + + new cursor._cursor._cursorHandle(); +}, [], "invoke constructor on CursorHandle"); +})(); |