mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 07:04:39 +00:00
Change test for remaining to test for * nargs
This commit is contained in:
parent
10ddd393b6
commit
2cfe115dfb
@ -121,12 +121,12 @@ TEST_CASE("Users can bind arguments to actions" * test_suite("actions")) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Users can use actions on remaining arguments" *
|
TEST_CASE("Users can use actions on nargs=ANY arguments" *
|
||||||
test_suite("actions")) {
|
test_suite("actions")) {
|
||||||
argparse::ArgumentParser program("sum");
|
argparse::ArgumentParser program("sum");
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
program.add_argument("all").remaining().action(
|
program.add_argument("all").nargs(argparse::NArgsPattern::ANY).action(
|
||||||
[](int &sum, std::string const &value) { sum += std::stoi(value); },
|
[](int &sum, std::string const &value) { sum += std::stoi(value); },
|
||||||
std::ref(result));
|
std::ref(result));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user