summaryrefslogtreecommitdiff
path: root/src/mongo/util/options_parser/options_parser_test.cpp
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@10gen.com>2014-02-05 15:05:39 -0500
committerShaun Verch <shaun.verch@10gen.com>2014-02-06 15:00:57 -0500
commit4ef1fec8348328429c11830c8789fb7376916f00 (patch)
treeb422da45409c312650db3b8cd4d8d38f3a51d481 /src/mongo/util/options_parser/options_parser_test.cpp
parenta4d29c5259098ddd2039d4d12f0a0f9786ebeeed (diff)
downloadmongo-4ef1fec8348328429c11830c8789fb7376916f00.tar.gz
SERVER-12589 Exclude empty sections in help output
Diffstat (limited to 'src/mongo/util/options_parser/options_parser_test.cpp')
-rw-r--r--src/mongo/util/options_parser/options_parser_test.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/util/options_parser/options_parser_test.cpp b/src/mongo/util/options_parser/options_parser_test.cpp
index aa73d36fb3c..7a90663f218 100644
--- a/src/mongo/util/options_parser/options_parser_test.cpp
+++ b/src/mongo/util/options_parser/options_parser_test.cpp
@@ -3830,4 +3830,22 @@ namespace {
ASSERT_NOT_OK(parser.run(testOpts, argv, env_map, &environment));
}
+ TEST(OptionCount, Basic) {
+ OptionsParserTester parser;
+ moe::Environment environment;
+
+ moe::OptionSection testOpts;
+ testOpts.addOptionChaining("basic", "basic", moe::String, "Basic Option");
+ testOpts.addOptionChaining("hidden", "hidden", moe::String, "Hidden Option").hidden();
+
+ moe::OptionSection subSection("Section Name");
+ subSection.addOptionChaining("port", "port", moe::Int, "Port")
+ .setSources(moe::SourceYAMLConfig);
+ testOpts.addSection(subSection);
+
+ int numOptions;
+ ASSERT_OK(testOpts.countOptions(&numOptions, true /*visibleOnly*/, moe::SourceCommandLine));
+ ASSERT_EQUALS(numOptions, 1);
+ }
+
} // unnamed namespace