diff options
author | Jarryd Beck <jarro.2783@gmail.com> | 2016-10-26 23:54:42 +0300 |
---|---|---|
committer | Jarryd Beck <jarro.2783@gmail.com> | 2016-10-26 23:54:42 +0300 |
commit | db674a467ff34b839078ca307b34f73596197001 (patch) | |
tree | f80b931c12941a68436d848f70369f6657a85eb7 | |
parent | c45bcc385870b8707ef5475cdd7c14b1ce7fc4a1 (diff) |
test for hiding optionsv1.0.0
-rw-r--r-- | test/options.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/options.cpp b/test/options.cpp index e957009..5e6b5c1 100644 --- a/test/options.cpp +++ b/test/options.cpp @@ -91,6 +91,33 @@ TEST_CASE("No positional", "[positional]") CHECK(strcmp(argv[1], "a") == 0); } +TEST_CASE("All positional", "[positional]") +{ + std::vector<std::string> positional; + + cxxopts::Options options("test_all_positional", " - test all positional"); + options.add_options() + ("positional", "Positional parameters", + cxxopts::value<std::vector<std::string>>(positional)) + ; + + Argv av({"tester", "a", "b", "c"}); + + auto argc = av.argc(); + auto argv = av.argv(); + + options.parse_positional("positional"); + + options.parse(argc, argv); + + REQUIRE(argc == 1); + REQUIRE(positional.size() == 3); + + CHECK(positional[0] == "a"); + CHECK(positional[1] == "b"); + CHECK(positional[2] == "c"); +} + TEST_CASE("Some positional explicit", "[positional]") { cxxopts::Options options("positional_explicit", " - test positional"); |