summaryrefslogtreecommitdiff
path: root/src/mongo/idl/idl_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/idl/idl_test.cpp')
-rw-r--r--src/mongo/idl/idl_test.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/idl/idl_test.cpp b/src/mongo/idl/idl_test.cpp
index 6bfb54782f9..206aa0b5aaf 100644
--- a/src/mongo/idl/idl_test.cpp
+++ b/src/mongo/idl/idl_test.cpp
@@ -2837,6 +2837,14 @@ TEST(IDLTypeCommand, TestStruct) {
assert_same_types<decltype(testStruct.getCommandParameter()),
mongo::idl::import::One_string&>();
+ // Negative: Command with struct parameter should disallow 'undefined' input.
+ {
+ auto invalidDoc = BSON(CommandTypeStructCommand::kCommandName << BSONUndefined << "$db"
+ << "db");
+ ASSERT_THROWS(CommandTypeStructCommand::parse(ctxt, makeOMR(invalidDoc)),
+ AssertionException);
+ }
+
// Positive: Test we can roundtrip from the just parsed document
{
BSONObjBuilder builder;