mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 20:23:55 +00:00
add extra test
This commit is contained in:
parent
afa7a45665
commit
bd4dc91184
@ -1389,7 +1389,7 @@ class App {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return True if a help flag detected (checks all parents)
|
||||
/// Return True if a help flag detected (checks all parents) (only run if help called before subcommand)
|
||||
bool _any_help_flag() const {
|
||||
bool result = false;
|
||||
const Option *help_ptr = get_help_ptr();
|
||||
|
@ -438,6 +438,8 @@ struct SubcommandProgram : public TApp {
|
||||
int count;
|
||||
|
||||
SubcommandProgram() {
|
||||
app.set_help_all_flag("--help-all");
|
||||
|
||||
start = app.add_subcommand("start", "Start prog");
|
||||
stop = app.add_subcommand("stop", "Stop prog");
|
||||
|
||||
@ -541,6 +543,18 @@ TEST_F(SubcommandProgram, HelpOrder) {
|
||||
EXPECT_THROW(run(), CLI::CallForHelp);
|
||||
}
|
||||
|
||||
TEST_F(SubcommandProgram, HelpAllOrder) {
|
||||
|
||||
args = {"--help-all"};
|
||||
EXPECT_THROW(run(), CLI::CallForAllHelp);
|
||||
|
||||
args = {"start", "--help-all"};
|
||||
EXPECT_THROW(run(), CLI::CallForAllHelp);
|
||||
|
||||
args = {"--help-all", "start"};
|
||||
EXPECT_THROW(run(), CLI::CallForAllHelp);
|
||||
}
|
||||
|
||||
TEST_F(SubcommandProgram, Callbacks) {
|
||||
|
||||
start->callback([]() { throw CLI::Success(); });
|
||||
|
Loading…
x
Reference in New Issue
Block a user