1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 20:23:55 +00:00

Fix test and use got_subcom properly

This commit is contained in:
Henry Fredrick Schreiner 2017-03-17 12:11:06 -04:00
parent c5582fe1a5
commit 21f9159750
2 changed files with 2 additions and 5 deletions

View File

@ -537,12 +537,9 @@ public:
/// Check with name instead of pointer
bool got_subcommand(std::string name) const {
for(const auto subcomptr : selected_subcommands_)
if(subcomptr->check_name(name))
return true;
for(const App_p &subcomptr : subcommands_)
if(subcomptr->check_name(name))
return false;
return got_subcommand(subcomptr.get());
throw CLI::OptionNotFound(name);
}

View File

@ -34,7 +34,7 @@ TEST_F(TApp, MultiSubFallthrough) {
args = {"sub1", "sub2"};
run();
EXPECT_TRUE(app.got_subcommand("sub1"));
EXPECT_TRUE(app.got_subcommand(sub1);
EXPECT_TRUE(app.got_subcommand(sub1));
EXPECT_TRUE(app.got_subcommand("sub2"));
app.reset();