mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-17 12:54:40 +00:00
Added unit test for mutex_args with three arguments
This commit is contained in:
parent
eea95c0e3a
commit
8f70dde82e
@ -37,3 +37,18 @@ TEST_CASE(
|
|||||||
"Argument '--second VAR' not allowed with '--first VAR'",
|
"Argument '--second VAR' not allowed with '--first VAR'",
|
||||||
std::runtime_error);
|
std::runtime_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Create mutually exclusive group with 3 arguments" *
|
||||||
|
test_suite("mutex_args")) {
|
||||||
|
argparse::ArgumentParser program("test");
|
||||||
|
|
||||||
|
auto &group = program.add_mutually_exclusive_group();
|
||||||
|
group.add_argument("--first");
|
||||||
|
group.add_argument("--second");
|
||||||
|
group.add_argument("--third");
|
||||||
|
|
||||||
|
REQUIRE_THROWS_WITH_AS(
|
||||||
|
program.parse_args({"test", "--first", "1", "--third", "2"}),
|
||||||
|
"Argument '--third VAR' not allowed with '--first VAR'",
|
||||||
|
std::runtime_error);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user