Skip to content

Commit

Permalink
[MISC] automatic linting
Browse files Browse the repository at this point in the history
  • Loading branch information
seqan-actions committed Feb 18, 2024
1 parent e081c1a commit 888e344
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 79 deletions.
4 changes: 2 additions & 2 deletions test/unit/detail/format_ctd_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ TEST_F(format_ctd_test, skipped)
TEST_F(format_ctd_test, empty_information)
{
// Create the dummy parser.
auto parser = get_parser( "--export-help", "ctd");
auto parser = get_parser("--export-help", "ctd");
parser.info.date = "December 01, 1994";
parser.info.version = "1.1.2-rc.1";
parser.info.man_page_title = "default_man_page_title";
Expand Down Expand Up @@ -142,7 +142,7 @@ TEST_F(format_ctd_test, empty_information)
TEST_F(format_ctd_test, full_information)
{
// Create the dummy parser.
auto parser = get_parser( "--export-help", "ctd");
auto parser = get_parser("--export-help", "ctd");

// Fill out the dummy parser with options and flags and sections and subsections.
dummy_init(parser);
Expand Down
27 changes: 13 additions & 14 deletions test/unit/detail/format_help_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@ class format_help_test : public sharg::test::test_fixture
bool flag_value{false};
std::vector<std::string> pos_opt_value{};

static inline std::string basic_options_str =
" Common options\n"
" -h, --help\n"
" Prints the help page.\n"
" -hh, --advanced-help\n"
" Prints the help page including advanced options.\n"
" --version\n"
" Prints the version information.\n"
" --copyright\n"
" Prints the copyright/license information.\n"
" --export-help (std::string)\n"
" Export the help page information. Value must be one of "
static inline std::string basic_options_str = " Common options\n"
" -h, --help\n"
" Prints the help page.\n"
" -hh, --advanced-help\n"
" Prints the help page including advanced options.\n"
" --version\n"
" Prints the version information.\n"
" --copyright\n"
" Prints the copyright/license information.\n"
" --export-help (std::string)\n"
" Export the help page information. Value must be one of "
#if SHARG_HAS_TDL
"[html, man,\n ctd, cwl].\n";
"[html, man,\n ctd, cwl].\n";
#else
"[html, man].\n";
"[html, man].\n";
#endif

static inline std::string basic_version_str = "VERSION\n"
Expand Down
16 changes: 8 additions & 8 deletions test/unit/detail/format_html_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ TEST_F(format_html_test, full_information_information)
parser.info.author = "author";
parser.info.email = "email";
parser.add_option(option_value,
sharg::config{.short_id = 'i',
.long_id = "int",
.description = "this is a int option.",
.default_message = "A number"});
sharg::config{.short_id = 'i',
.long_id = "int",
.description = "this is a int option.",
.default_message = "A number"});
parser.add_option(option_value,
sharg::config{.short_id = 'j',
.long_id = "jint",
.description = "this is a required int option.",
.required = true});
sharg::config{.short_id = 'j',
.long_id = "jint",
.description = "this is a required int option.",
.required = true});
parser.add_flag(flag_value, sharg::config{.short_id = 'f', .long_id = "flag", .description = "this is a flag."});
parser.add_flag(flag_value, sharg::config{.short_id = 'k', .long_id = "kflag", .description = "this is a flag."});
parser.add_positional_option(non_list_pos_opt_value, sharg::config{.description = "this is a positional option."});
Expand Down
109 changes: 54 additions & 55 deletions test/unit/detail/format_man_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,64 +190,63 @@ TEST_F(format_man_test, empty_information)
parser.info.man_page_title = "default_man_page_title";
parser.info.short_description = "A short description here.";

std::string expected =
R"(.TH TEST_PARSER 1 "December 01, 1994" "test_parser 01.01.01" "default_man_page_title")"
"\n"
R"(.SH NAME)"
"\n"
R"(test_parser \- A short description here.)"
"\n"
R"(.SH OPTIONS)"
"\n"
R"(.SS Common options)"
"\n"
R"(.TP)"
"\n"
R"(\fB-h\fP, \fB--help\fP)"
"\n"
R"(Prints the help page.)"
"\n"
R"(.TP)"
"\n"
R"(\fB-hh\fP, \fB--advanced-help\fP)"
"\n"
R"(Prints the help page including advanced options.)"
"\n"
R"(.TP)"
"\n"
R"(\fB--version\fP)"
"\n"
R"(Prints the version information.)"
"\n"
R"(.TP)"
"\n"
R"(\fB--copyright\fP)"
"\n"
R"(Prints the copyright/license information.)"
"\n"
R"(.TP)"
"\n"
R"(\fB--export-help\fP (std::string))"
"\n"
R"(Export the help page information. Value must be one of )"
std::string expected = R"(.TH TEST_PARSER 1 "December 01, 1994" "test_parser 01.01.01" "default_man_page_title")"
"\n"
R"(.SH NAME)"
"\n"
R"(test_parser \- A short description here.)"
"\n"
R"(.SH OPTIONS)"
"\n"
R"(.SS Common options)"
"\n"
R"(.TP)"
"\n"
R"(\fB-h\fP, \fB--help\fP)"
"\n"
R"(Prints the help page.)"
"\n"
R"(.TP)"
"\n"
R"(\fB-hh\fP, \fB--advanced-help\fP)"
"\n"
R"(Prints the help page including advanced options.)"
"\n"
R"(.TP)"
"\n"
R"(\fB--version\fP)"
"\n"
R"(Prints the version information.)"
"\n"
R"(.TP)"
"\n"
R"(\fB--copyright\fP)"
"\n"
R"(Prints the copyright/license information.)"
"\n"
R"(.TP)"
"\n"
R"(\fB--export-help\fP (std::string))"
"\n"
R"(Export the help page information. Value must be one of )"
#if SHARG_HAS_TDL
"[html, man, ctd, cwl]."
"[html, man, ctd, cwl]."
#else
"[html, man]."
"[html, man]."
#endif
"\n"
R"(.SH VERSION)"
"\n"
R"(\fBLast update: \fRDecember 01, 1994)"
"\n"
R"(.br)"
"\n"
R"(\fBtest_parser version: \fR01.01.01)"
"\n"
R"(.br)"
"\n"
R"(\fBSharg version: \fR)"
+ version_str + "\n";
"\n"
R"(.SH VERSION)"
"\n"
R"(\fBLast update: \fRDecember 01, 1994)"
"\n"
R"(.br)"
"\n"
R"(\fBtest_parser version: \fR01.01.01)"
"\n"
R"(.br)"
"\n"
R"(\fBSharg version: \fR)"
+ version_str + "\n";
EXPECT_EQ(get_parse_cout_on_exit(parser), expected);
}

Expand Down

0 comments on commit 888e344

Please sign in to comment.