Skip to content

Commit

Permalink
Adding a couple of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Nov 19, 2017
1 parent 20cccfc commit 5f1df63
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/CreationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5f1df63

Please sign in to comment.