aboutsummaryrefslogtreecommitdiff
path: root/test.cxx
diff options
context:
space:
mode:
authorPavel Belikov <pavel.fuchs.belikov@gmail.com>2017-12-12 20:46:40 +0300
committerPavel Belikov <pavel.fuchs.belikov@gmail.com>2017-12-12 20:46:40 +0300
commit1b2f44572bdb93015f12d98ee4447996ab8d28e5 (patch)
treec93c196a6d4eff377df9c64b5112f74cbea990db /test.cxx
parentMerge pull request #51 from pavel-belikov/fix-usage-wrapping (diff)
downloadargs.hxx-1b2f44572bdb93015f12d98ee4447996ab8d28e5.tar.xz
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