Added unit test for mutex_args with three arguments

This commit is contained in:
Pranav Srinivas Kumar 2023-11-04 15:20:47 -05:00
parent eea95c0e3a
commit 8f70dde82e

View File

@ -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);
}