Uninitialized variables: Added test case

This commit is contained in:
Daniel Marjamäki 2012-06-23 15:52:35 +02:00
parent 7f5950967e
commit d3ce3e78bd
1 changed files with 16 additions and 6 deletions

View File

@ -317,12 +317,22 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("A a()\n"
"{\n"
" A ret;\n"
" return ret;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
{
checkUninitVar("A a()\n"
"{\n"
" A ret;\n"
" return ret;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("A a()\n"
"{\n"
" A ret;\n"
" return ret;\n"
"}\n",
"test.c");
ASSERT_EQUALS("[test.c:4]: (error) Uninitialized variable: ret\n", errout.str());
}
checkUninitVar("int a()\n"
"{\n"