diff --git a/include/sharg/parser.hpp b/include/sharg/parser.hpp index f3be89d3..b0af44a7 100644 --- a/include/sharg/parser.hpp +++ b/include/sharg/parser.hpp @@ -740,6 +740,7 @@ class parser //!\brief List of option/flag identifiers that are already used. std::unordered_set used_option_ids{{'h', "help"}, {'\0' /*hh*/, "advanced-help"}, + {'\0', "hh"}, {'\0', "export-help"}, {'\0', "version"}, {'\0', "copyright"}}; diff --git a/test/unit/parser/parser_design_error_test.cpp b/test/unit/parser/parser_design_error_test.cpp index 895597c4..9e56aa9a 100644 --- a/test/unit/parser/parser_design_error_test.cpp +++ b/test/unit/parser/parser_design_error_test.cpp @@ -72,8 +72,11 @@ TEST_F(verify_option_config_test, special_identifiers) auto parser = get_parser(); EXPECT_THROW(parser.add_option(option_value, sharg::config{.short_id = 'h'}), sharg::design_error); EXPECT_THROW(parser.add_option(option_value, sharg::config{.long_id = "help"}), sharg::design_error); + EXPECT_THROW(parser.add_option(option_value, sharg::config{.long_id = "hh"}), sharg::design_error); EXPECT_THROW(parser.add_option(option_value, sharg::config{.long_id = "advanced-help"}), sharg::design_error); EXPECT_THROW(parser.add_option(option_value, sharg::config{.long_id = "export-help"}), sharg::design_error); + EXPECT_THROW(parser.add_option(option_value, sharg::config{.long_id = "version"}), sharg::design_error); + EXPECT_THROW(parser.add_option(option_value, sharg::config{.long_id = "copyright"}), sharg::design_error); } TEST_F(verify_option_config_test, single_character_long_id)