mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 20:23:55 +00:00
Adding new tests for red lines
This commit is contained in:
parent
3da480792b
commit
0973f348d2
@ -892,3 +892,43 @@ TEST_F(TApp, CheckSubcomFail) {
|
||||
|
||||
EXPECT_THROW(CLI::detail::AppFriend::parse_subcommand(&app, args), CLI::HorribleError);
|
||||
}
|
||||
|
||||
// Added to test defaults on dual method
|
||||
TEST_F(TApp, OptionWithDefaults) {
|
||||
int someint=2;
|
||||
app.add_option("-a", someint, "", true);
|
||||
|
||||
args = {"-a1", "-a2"};
|
||||
|
||||
EXPECT_THROW(run(), CLI::ConversionError);
|
||||
}
|
||||
|
||||
// Added to test defaults on dual method
|
||||
TEST_F(TApp, SetWithDefaults) {
|
||||
int someint=2;
|
||||
app.add_set("-a", someint, {1,2,3,4}, "", true);
|
||||
|
||||
args = {"-a1", "-a2"};
|
||||
|
||||
EXPECT_THROW(run(), CLI::ConversionError);
|
||||
}
|
||||
|
||||
// Added to test defaults on dual method
|
||||
TEST_F(TApp, SetWithDefaultsConversion) {
|
||||
int someint=2;
|
||||
app.add_set("-a", someint, {1,2,3,4}, "", true);
|
||||
|
||||
args = {"-a", "hi"};
|
||||
|
||||
EXPECT_THROW(run(), CLI::ConversionError);
|
||||
}
|
||||
|
||||
// Added to test defaults on dual method
|
||||
TEST_F(TApp, SetWithDefaultsIC) {
|
||||
std::string someint="ho";
|
||||
app.add_set_ignore_case("-a", someint, {"Hi", "Ho"}, "", true);
|
||||
|
||||
args = {"-aHi", "-aHo"};
|
||||
|
||||
EXPECT_THROW(run(), CLI::ConversionError);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user