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:
parent
c5582fe1a5
commit
21f9159750
@ -537,12 +537,9 @@ public:
|
|||||||
|
|
||||||
/// Check with name instead of pointer
|
/// Check with name instead of pointer
|
||||||
bool got_subcommand(std::string name) const {
|
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_)
|
for(const App_p &subcomptr : subcommands_)
|
||||||
if(subcomptr->check_name(name))
|
if(subcomptr->check_name(name))
|
||||||
return false;
|
return got_subcommand(subcomptr.get());
|
||||||
throw CLI::OptionNotFound(name);
|
throw CLI::OptionNotFound(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ TEST_F(TApp, MultiSubFallthrough) {
|
|||||||
args = {"sub1", "sub2"};
|
args = {"sub1", "sub2"};
|
||||||
run();
|
run();
|
||||||
EXPECT_TRUE(app.got_subcommand("sub1"));
|
EXPECT_TRUE(app.got_subcommand("sub1"));
|
||||||
EXPECT_TRUE(app.got_subcommand(sub1);
|
EXPECT_TRUE(app.got_subcommand(sub1));
|
||||||
EXPECT_TRUE(app.got_subcommand("sub2"));
|
EXPECT_TRUE(app.got_subcommand("sub2"));
|
||||||
|
|
||||||
app.reset();
|
app.reset();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user