From 1b807e1f1a9da3ad62d32ba07197e7d394f9bbd7 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 27 Dec 2024 20:30:55 +0100 Subject: [PATCH] Add test for #11 (#7140) --- test/testother.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 5f725eeda0c..824116c567b 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -5649,6 +5649,19 @@ class TestOther : public TestFixture { " }\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + check("int main(int argc, char *argv[]) {\n" // #11 + " switch (argc) {\n" + " case 0: {\n" + " return 1;\n" + " }\n" + " break;\n" + " }\n" + " return 0;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:6]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n" + "[test.cpp:1]: (style) Parameter 'argv' can be declared as const array\n", + errout_str()); } void redundantContinue() {