Restore a "remaining" test case for compat

This commit is contained in:
Yoshihiro Hokazono 2022-06-21 06:30:45 +09:00
parent 14abaa47d9
commit 6dfaa1c20c
2 changed files with 6 additions and 7 deletions

View File

@ -88,10 +88,10 @@ TEST_CASE("Parse optional arguments of many values" *
program.add_argument("-i").remaining().scan<'i', int>(); program.add_argument("-i").remaining().scan<'i', int>();
WHEN("provided no argument") { WHEN("provided no argument") {
THEN("the program accepts it and gets empty container") { THEN("the program accepts it bug gets nothing") {
REQUIRE_NOTHROW(program.parse_args({"test"})); REQUIRE_NOTHROW(program.parse_args({"test"}));
auto inputs = program.get<std::vector<int>>("-i"); REQUIRE_THROWS_AS(program.get<std::vector<int>>("-i"),
REQUIRE(inputs.size() == 0); std::logic_error);
} }
} }

View File

@ -193,11 +193,10 @@ TEST_CASE("Parse remaining arguments deemed positional" *
program.add_argument("input").remaining(); program.add_argument("input").remaining();
WHEN("provided no argument") { WHEN("provided no argument") {
THEN("the program accepts it and gets empty container") { THEN("the program accepts it but gets nothing") {
REQUIRE_NOTHROW(program.parse_args({"test"})); REQUIRE_NOTHROW(program.parse_args({"test"}));
REQUIRE_THROWS_AS(program.get<std::vector<std::string>>("input"),
auto inputs = program.get<std::vector<std::string>>("input"); std::logic_error);
REQUIRE(inputs.size() == 0);
} }
} }