mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-01 13:13:53 +00:00
Adding a couple of tests
This commit is contained in:
parent
20cccfc353
commit
5f1df630d7
@ -137,6 +137,20 @@ TEST_F(TApp, IncorrectConstructionVectorAsFlag) {
|
||||
EXPECT_THROW(cat->expected(0), CLI::IncorrectConstruction);
|
||||
}
|
||||
|
||||
TEST_F(TApp, IncorrectConstructionVectorTakeLast) {
|
||||
std::vector<int> vec;
|
||||
auto cat = app.add_option("--vec", vec);
|
||||
EXPECT_THROW(cat->take_last(), CLI::IncorrectConstruction);
|
||||
}
|
||||
|
||||
TEST_F(TApp, IncorrectConstructionTakeLastExpected) {
|
||||
std::vector<int> vec;
|
||||
auto cat = app.add_option("--vec", vec);
|
||||
cat->expected(1);
|
||||
ASSERT_NO_THROW(cat->take_last());
|
||||
EXPECT_THROW(cat->expected(2), CLI::IncorrectConstruction);
|
||||
}
|
||||
|
||||
TEST_F(TApp, IncorrectConstructionRequiresCannotFind) {
|
||||
auto cat = app.add_flag("--cat");
|
||||
EXPECT_THROW(cat->requires("--nothing"), CLI::IncorrectConstruction);
|
||||
|
Loading…
x
Reference in New Issue
Block a user