aboutsummaryrefslogtreecommitdiff
path: root/test.cxx
diff options
context:
space:
mode:
authorTaylor C. Richberger <taywee@gmx.com>2017-12-12 13:55:52 -0700
committerGitHub <noreply@github.com>2017-12-12 13:55:52 -0700
commit4ac0840b657a8e4e74ea6742f8cab7e24acd771c (patch)
treec93c196a6d4eff377df9c64b5112f74cbea990db /test.cxx
parentMerge pull request #51 from pavel-belikov/fix-usage-wrapping (diff)
parentadd more GetChoicesString overrides (diff)
downloadargs.hxx-4ac0840b657a8e4e74ea6742f8cab7e24acd771c.tar.xz
Merge pull request #53 from pavel-belikov/map-flag-list-choices
Add more GetChoicesString overrides
Diffstat (limited to 'test.cxx')
-rw-r--r--test.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/test.cxx b/test.cxx
index 911779d..1ad728b 100644
--- a/test.cxx
+++ b/test.cxx
@@ -1227,6 +1227,20 @@ TEST_CASE("Default values work as expected", "[args]")
)");
}
+TEST_CASE("Choices description works as expected", "[args]")
+{
+ args::ArgumentParser p("parser");
+ args::MapFlag<int, int> map(p, "map", "map", {"map"}, {{1,1}, {2, 2}});
+ args::MapFlagList<char, int> maplist(p, "maplist", "maplist", {"maplist"}, {{'1',1}, {'2', 2}});
+ args::MapPositional<std::string, int, args::ValueReader, std::map> mappos(p, "mappos", "mappos", {{"1",1}, {"2", 2}});
+ args::MapPositionalList<char, int, std::vector, args::ValueReader, std::map> mapposlist(p, "mapposlist", "mapposlist", {{'1',1}, {'2', 2}});
+
+ REQUIRE(map.HelpChoices(p.helpParams) == "1, 2");
+ REQUIRE(maplist.HelpChoices(p.helpParams) == "1, 2");
+ REQUIRE(mappos.HelpChoices(p.helpParams) == "1, 2");
+ REQUIRE(mapposlist.HelpChoices(p.helpParams) == "1, 2");
+}
+
#undef ARGS_HXX
#define ARGS_TESTNAMESPACE
#define ARGS_NOEXCEPT