Added a regression test for ticket 6928 - Improve check: unused variables, goto
This commit is contained in:
parent
3a5931b417
commit
1d2beb0431
|
@ -129,6 +129,7 @@ private:
|
|||
TEST_CASE(localvar60);
|
||||
TEST_CASE(localvar61); // #9407
|
||||
TEST_CASE(localvar62); // #10824
|
||||
TEST_CASE(localvar63); // #6928
|
||||
TEST_CASE(localvarloops); // loops
|
||||
TEST_CASE(localvaralias1);
|
||||
TEST_CASE(localvaralias2); // ticket #1637
|
||||
|
@ -3362,6 +3363,15 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvar63() { // #6928
|
||||
functionVariableUsage("void f(void) {\n"
|
||||
" int x=3;\n" // <- set but not used
|
||||
" goto y;\n"
|
||||
" y:return;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'x' is assigned a value that is never used.\n", errout.str());
|
||||
}
|
||||
|
||||
void localvarloops() {
|
||||
// loops
|
||||
functionVariableUsage("void fun(int c) {\n"
|
||||
|
|
Loading…
Reference in New Issue