From 3dc65d1290440e2e8408bd34bfb9330b59cf2e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Fri, 27 Dec 2024 15:07:16 +0100 Subject: [PATCH] add defaultReportType test --- test/testcmdlineparser.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 4b0093ae059..158ef3a6732 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -455,6 +455,7 @@ class TestCmdlineParser : public TestFixture { TEST_CASE(reportTypeMisraCpp2008); TEST_CASE(reportTypeMisraCpp2023); TEST_CASE(invalidReportType); + TEST_CASE(defaultReportType); } void nooptions() { @@ -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)