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

Adding more tests

This commit is contained in:
Henry Fredrick Schreiner 2017-11-16 12:43:09 -05:00 committed by Henry Schreiner
parent 59b6de2550
commit 89c57961f4

View File

@ -299,10 +299,10 @@ TEST_F(TApp, SubComExtras) {
app.reset();
// args = {"sub", "extra"};
// run();
// EXPECT_EQ(app.remaining(), std::vector<std::string>());
// EXPECT_EQ(sub->remaining(), std::vector<std::string>({"extra"}));
args = {"sub", "extra1", "extra2"};
run();
EXPECT_EQ(app.remaining(), std::vector<std::string>());
EXPECT_EQ(sub->remaining(), std::vector<std::string>({"extra1", "extra2"}));
}
TEST_F(TApp, Required1SubCom) {
@ -342,6 +342,20 @@ TEST_F(TApp, PrefixProgram) {
EXPECT_EQ(app.remaining(), std::vector<std::string>({"other", "--simple", "--mine"}));
}
TEST_F(TApp, PrefixSubcom) {
auto subc = app.add_subcommand("subc");
subc->prefix_command();
app.add_flag("--simple");
args = {"--simple", "subc", "other", "--simple", "--mine"};
run();
EXPECT_EQ(app.remaining_size(), (size_t) 0);
EXPECT_EQ(app.remaining_size(true), (size_t) 3);
EXPECT_EQ(subc->remaining(), std::vector<std::string>({"other", "--simple", "--mine"}));
}
struct SubcommandProgram : public TApp {
CLI::App *start;