summaryrefslogtreecommitdiff
path: root/src/mongo/idl
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2019-01-03 19:09:36 +0000
committerSara Golemon <sara.golemon@mongodb.com>2019-01-04 22:08:15 +0000
commit28e7a275a1d6b529bee593b58c60dfc9cd507d09 (patch)
treebcf7c7771598049e156b2f03e7bc7e0d9c68685a /src/mongo/idl
parent1450cb71819f64f17d45c41057df80dae7beba79 (diff)
downloadmongo-28e7a275a1d6b529bee593b58c60dfc9cd507d09.tar.gz
SERVER-38826 Export yaml constant values as C++ constexprs
Diffstat (limited to 'src/mongo/idl')
-rw-r--r--src/mongo/idl/server_parameter_with_storage_test.cpp7
-rw-r--r--src/mongo/idl/server_parameter_with_storage_test.h1
-rw-r--r--src/mongo/idl/server_parameter_with_storage_test.idl9
3 files changed, 15 insertions, 2 deletions
diff --git a/src/mongo/idl/server_parameter_with_storage_test.cpp b/src/mongo/idl/server_parameter_with_storage_test.cpp
index 547e5ad23e5..eacbeeb94bd 100644
--- a/src/mongo/idl/server_parameter_with_storage_test.cpp
+++ b/src/mongo/idl/server_parameter_with_storage_test.cpp
@@ -258,5 +258,12 @@ TEST(IDLServerParameterWithStorage, startupIntWithExpressions) {
ASSERT_EQ(test::gStartupIntWithExpressions, test::kStartupIntWithExpressionsMaximum);
}
+TEST(IDLServerParameterWithStorage, exportedDefaults) {
+ ASSERT_EQ(test::kStdIntPreallocatedDefault, 11);
+ ASSERT_EQ(test::kStdIntDeclaredDefault, 42);
+ ASSERT_EQ(test::kStartupIntWithExpressionsDefault, 100);
+ ASSERT_EQ(test::kUgly_complicated_name_spDefault, true);
+}
+
} // namespace
} // namespace mongo
diff --git a/src/mongo/idl/server_parameter_with_storage_test.h b/src/mongo/idl/server_parameter_with_storage_test.h
index 3aedab52ac0..57f12e6aa15 100644
--- a/src/mongo/idl/server_parameter_with_storage_test.h
+++ b/src/mongo/idl/server_parameter_with_storage_test.h
@@ -36,7 +36,6 @@
namespace mongo {
namespace test {
-constexpr std::int32_t kStartupIntWithExpressionsDefault = 100;
constexpr std::int32_t kStartupIntWithExpressionsMinimum = 10;
constexpr std::int32_t kStartupIntWithExpressionsMaximum = 1000;
diff --git a/src/mongo/idl/server_parameter_with_storage_test.idl b/src/mongo/idl/server_parameter_with_storage_test.idl
index 3e310375f5b..bc985613bac 100644
--- a/src/mongo/idl/server_parameter_with_storage_test.idl
+++ b/src/mongo/idl/server_parameter_with_storage_test.idl
@@ -76,8 +76,15 @@ server_parameters:
description: "Use of c++ expressions in default and validators"
cpp_vartype: "std::int32_t"
cpp_varname: gStartupIntWithExpressions
- default: { expr: kStartupIntWithExpressionsDefault }
+ default: 100
validator:
gte: { expr: kStartupIntWithExpressionsMinimum, is_constexpr: false }
lte: { expr: kStartupIntWithExpressionsMaximum, is_constexpr: true }
+ 'ugly complicated-name.sp':
+ set_at: startup
+ description: "Verify exported symbols are properly reformatted"
+ cpp_vartype: bool
+ cpp_varname: gUglyComplicatedNameSp
+ default: true
+