Added unit test for #5

This commit is contained in:
Robert Reif 2010-05-09 07:10:51 +02:00 committed by Daniel Marjamäki
parent 8971d697b2
commit 87a54580a8
1 changed files with 11 additions and 0 deletions

View File

@ -76,6 +76,7 @@ private:
TEST_CASE(localvar11); TEST_CASE(localvar11);
TEST_CASE(localvar12); TEST_CASE(localvar12);
TEST_CASE(localvar13); // ticket #1640 TEST_CASE(localvar13); // ticket #1640
TEST_CASE(localvar14); // ticket #5
TEST_CASE(localvaralias1); TEST_CASE(localvaralias1);
TEST_CASE(localvaralias2); // ticket #1637 TEST_CASE(localvaralias2); // ticket #1637
TEST_CASE(localvaralias3); // ticket #1639 TEST_CASE(localvaralias3); // ticket #1639
@ -1049,6 +1050,16 @@ private:
ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'x' is assigned a value that is never used\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'x' is assigned a value that is never used\n", errout.str());
} }
void localvar14()
{
// ticket #5
functionVariableUsage("void foo()\n"
"{\n"
" int a[10];\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: a\n", errout.str());
}
void localvaralias1() void localvaralias1()
{ {
functionVariableUsage("void foo()\n" functionVariableUsage("void foo()\n"