mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 12:13:52 +00:00
Add failing test for repeated multi-argument options
This commit is contained in:
parent
4fdf8322d3
commit
5fe44fc713
@ -1581,3 +1581,17 @@ TEST_F(TApp, AddRemoveSetItemsNoCase) {
|
|||||||
args = {"--type2", "TYpE2"};
|
args = {"--type2", "TYpE2"};
|
||||||
EXPECT_THROW(run(), CLI::ConversionError);
|
EXPECT_THROW(run(), CLI::ConversionError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #128
|
||||||
|
TEST_F(TApp, RepeatingMultiArgumentOptions) {
|
||||||
|
std::vector<std::string> entries;
|
||||||
|
app.add_option("--entry", entries, "set a key and value")->type_name("KEY VALUE")->type_size(-2);
|
||||||
|
|
||||||
|
args = {"--entry", "key1", "value1", "--entry", "key2", "value2"};
|
||||||
|
EXPECT_NO_THROW(run());
|
||||||
|
EXPECT_EQ(entries, std::vector<std::string>({"key1", "value1", "key2", "value2"}));
|
||||||
|
|
||||||
|
app.reset();
|
||||||
|
args.pop_back();
|
||||||
|
ASSERT_THROW(run(), CLI::ValidationError);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user