mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-16 20:34:39 +00:00
Added unit test for mutex_args with three arguments
This commit is contained in:
parent
eea95c0e3a
commit
8f70dde82e
@ -36,4 +36,19 @@ TEST_CASE(
|
||||
program_copy.parse_args({"test", "--first", "1", "--second", "2"}),
|
||||
"Argument '--second VAR' not allowed with '--first VAR'",
|
||||
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