summaryrefslogtreecommitdiff
path: root/src/mongo/idl
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2017-06-29 11:53:10 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2017-06-29 11:53:10 -0400
commit0966ba7c98dcd47d6fff753cf380d1c38c2c3d2b (patch)
tree548e4b3d45888789d1e0a75c9d04fc4aa7e512dc /src/mongo/idl
parent103256372fc4f4cec1c736482c1ed520ee0de290 (diff)
downloadmongo-0966ba7c98dcd47d6fff753cf380d1c38c2c3d2b.tar.gz
SERVER-29634 Support overriding the C++ name for chained structs/types in IDL
Diffstat (limited to 'src/mongo/idl')
-rw-r--r--src/mongo/idl/idl_test.cpp12
-rw-r--r--src/mongo/idl/unittest.idl16
2 files changed, 15 insertions, 13 deletions
diff --git a/src/mongo/idl/idl_test.cpp b/src/mongo/idl/idl_test.cpp
index 24af110112d..2d004ca9549 100644
--- a/src/mongo/idl/idl_test.cpp
+++ b/src/mongo/idl/idl_test.cpp
@@ -1223,7 +1223,7 @@ TEST(IDLChainedType, TestChainedStruct) {
assert_same_types<decltype(testStruct.getChained_any_basic_type()),
const Chained_any_basic_type&>();
- assert_same_types<decltype(testStruct.getChained_object_basic_type()),
+ assert_same_types<decltype(testStruct.getChainedObjectBasicType()),
const Chained_object_basic_type&>();
ASSERT_EQUALS(testStruct.getField3(), "abc");
@@ -1316,13 +1316,13 @@ TEST(IDLChainedType, TestChainedMixedStruct) {
auto testStruct = Chained_struct_type_mixed::parse(ctxt, testDoc);
- assert_same_types<decltype(testStruct.getChainedType()), const mongo::ChainedType&>();
+ assert_same_types<decltype(testStruct.getChained_type()), const mongo::ChainedType&>();
assert_same_types<decltype(testStruct.getAnotherChainedType()),
const mongo::AnotherChainedType&>();
- ASSERT_EQUALS(testStruct.getChainedType().getField1(), "abc");
+ ASSERT_EQUALS(testStruct.getChained_type().getField1(), "abc");
ASSERT_EQUALS(testStruct.getAnotherChainedType().getField2(), 5);
- ASSERT_EQUALS(testStruct.getChained_string_basic_type().getStringField(), "def");
+ ASSERT_EQUALS(testStruct.getChainedStringBasicType().getStringField(), "def");
ASSERT_EQUALS(testStruct.getField3(), 456);
// Positive: Test we can roundtrip from the just parsed document
@@ -1340,14 +1340,14 @@ TEST(IDLChainedType, TestChainedMixedStruct) {
Chained_struct_type_mixed one_new;
ChainedType ct;
ct.setField1("abc");
- one_new.setChainedType(ct);
+ one_new.setChained_type(ct);
AnotherChainedType act;
act.setField2(5);
one_new.setAnotherChainedType(act);
one_new.setField3(456);
Chained_string_basic_type csbt;
csbt.setStringField("def");
- one_new.setChained_string_basic_type(csbt);
+ one_new.setChainedStringBasicType(csbt);
one_new.serialize(&builder);
auto serializedDoc = builder.obj();
diff --git a/src/mongo/idl/unittest.idl b/src/mongo/idl/unittest.idl
index 439681f4435..b58bd804875 100644
--- a/src/mongo/idl/unittest.idl
+++ b/src/mongo/idl/unittest.idl
@@ -422,15 +422,15 @@ structs:
description: UnitTest for chained struct with only chained types
strict: false
chained_types:
- - ChainedType
- - AnotherChainedType
+ ChainedType : ChainedType
+ AnotherChainedType : AnotherChainedType
chained_struct_mixed:
description: Chained struct with chained structs and fields
strict: true
chained_structs:
- - chained_any_basic_type
- - chained_object_basic_type
+ chained_any_basic_type : chained_any_basic_type
+ chained_object_basic_type : ChainedObjectBasicType
fields:
field3: string
@@ -438,10 +438,12 @@ structs:
description: Chained struct with chained types, structs, and fields
strict: false
chained_types:
- - ChainedType
- - AnotherChainedType
+ ChainedType : chained_type
+ AnotherChainedType:
+ cpp_name: AnotherChainedType
chained_structs:
- - chained_string_basic_type
+ chained_string_basic_type:
+ cpp_name: ChainedStringBasicType
fields:
field3:
type: int