Skip to content

Commit

Permalink
add defaultReportType test
Browse files Browse the repository at this point in the history
  • Loading branch information
ludviggunne committed Dec 27, 2024
1 parent 6854010 commit 3dc65d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/testcmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ class TestCmdlineParser : public TestFixture {
TEST_CASE(reportTypeMisraCpp2008);
TEST_CASE(reportTypeMisraCpp2023);
TEST_CASE(invalidReportType);
TEST_CASE(defaultReportType);
}

void nooptions() {
Expand Down Expand Up @@ -3119,6 +3120,13 @@ class TestCmdlineParser : public TestFixture {
ASSERT_EQUALS_ENUM(CmdLineParser::Result::Fail, parser->parseFromArgs(3, argv));
ASSERT_EQUALS("cppcheck: error: Unknown report type 'invalid'\n", logger->str());
}

void defaultReportType() {
REDIRECT;
const char *const argv[] = { "cppcheck", "file.cpp" };
ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parser->parseFromArgs(2, argv));
ASSERT_EQUALS_ENUM(checkers::ReportType::normal, settings->reportType);
}
};

REGISTER_TEST(TestCmdlineParser)

0 comments on commit 3dc65d1

Please sign in to comment.