Fix tests for remaining

This commit is contained in:
Yoshihiro Hokazono 2021-09-16 06:40:11 +09:00
parent c99272b93d
commit 10ddd393b6
2 changed files with 7 additions and 6 deletions

View File

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

View File

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