Skip to content

Commit

Permalink
reserve hh
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Mar 13, 2024
1 parent 6ee95cb commit c745213
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/sharg/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ class parser
//!\brief List of option/flag identifiers that are already used.
std::unordered_set<detail::id_pair> used_option_ids{{'h', "help"},
{'\0' /*hh*/, "advanced-help"},
{'\0', "hh"},
{'\0', "export-help"},
{'\0', "version"},
{'\0', "copyright"}};
Expand Down
3 changes: 3 additions & 0 deletions test/unit/parser/parser_design_error_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c745213

Please sign in to comment.