File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -975,7 +975,7 @@ class App {
975975 // / creates an option group as part of the given app
976976 template <typename T = Option_group>
977977 T *add_option_group (std::string group_name, std::string group_description = " " ) {
978- auto option_group = std::make_shared<T>(std::move (group_description), group_name, nullptr );
978+ auto option_group = std::make_shared<T>(std::move (group_description), group_name, this );
979979 auto ptr = option_group.get ();
980980 // move to App_p for overload resolution on older gcc versions
981981 App_p app_ptr = std::dynamic_pointer_cast<App>(option_group);
Original file line number Diff line number Diff line change @@ -368,6 +368,18 @@ TEST_F(TApp, InvalidOptions) {
368368 EXPECT_THROW (ogroup->add_option (opt), CLI::OptionNotFound);
369369}
370370
371+ TEST_F (TApp, OptionGroupInheritedOptionDefaults) {
372+ app.option_defaults ()->ignore_case ();
373+ auto ogroup = app.add_option_group (" clusters" );
374+ int res{0 };
375+ ogroup->add_option (" --test1" , res);
376+
377+ args = {" --Test1" , " 5" };
378+ run ();
379+ EXPECT_EQ (res, 5 );
380+ EXPECT_EQ (app.count_all (), 1u );
381+ }
382+
371383struct ManyGroups : public TApp {
372384
373385 CLI::Option_group *main{nullptr };
You can’t perform that action at this time.
0 commit comments