From f0ae519bdf43a67cfb6b238e28bdcc75917d94de Mon Sep 17 00:00:00 2001 From: Pavel Belikov Date: Sat, 23 Dec 2017 16:30:37 +0300 Subject: add completion for flag values --- test.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test.cxx') diff --git a/test.cxx b/test.cxx index 2d3b625..4768cde 100644 --- a/test.cxx +++ b/test.cxx @@ -1257,6 +1257,11 @@ TEST_CASE("Completion works as expected", "[args]") REQUIRE_THROWS_WITH(p.ParseArgs(std::vector{"--completion", "bash", "1", "test", "-"}), Equals("-f\n-b")); REQUIRE_THROWS_WITH(p.ParseArgs(std::vector{"--completion", "bash", "1", "test", "-f"}), Equals("-f")); REQUIRE_THROWS_WITH(p.ParseArgs(std::vector{"--completion", "bash", "1", "test", "--"}), Equals("--foo\n--bar")); + + args::MapFlag m(p, "mappos", "mappos", {'m', "map"}, {{"1",1}, {"2", 2}}); + REQUIRE_THROWS_WITH(p.ParseArgs(std::vector{"--completion", "bash", "2", "test", "-m", ""}), Equals("1\n2")); + REQUIRE_THROWS_WITH(p.ParseArgs(std::vector{"--completion", "bash", "1", "test", "--map="}), Equals("--map=1\n--map=2")); + REQUIRE_THROWS_WITH(p.ParseArgs(std::vector{"--completion", "bash", "1", "test", "-m1"}), Equals("-m1")); } #undef ARGS_HXX -- cgit v1.2.1