1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 12:13:52 +00:00

Add excludes test on option_groups

This commit is contained in:
Philip Top 2019-03-05 11:01:46 -08:00 committed by Henry Schreiner
parent fe7e84f29a
commit 6ad2641d63

View File

@ -420,6 +420,19 @@ TEST_F(ManyGroups, SingleGroup) {
EXPECT_THROW(run(), CLI::RequiredError); EXPECT_THROW(run(), CLI::RequiredError);
} }
TEST_F(ManyGroups, ExcludesGroup) {
// only 1 group can be used
g1->excludes(g2);
g1->excludes(g3);
args = {"--name1", "test"};
run();
EXPECT_EQ(name1, "test");
args = {"--name1", "test", "--name2", "test2"};
EXPECT_THROW(run(), CLI::ExcludesError);
}
TEST_F(ManyGroups, SingleGroupError) { TEST_F(ManyGroups, SingleGroupError) {
// only 1 group can be used // only 1 group can be used
main->require_option(1); main->require_option(1);