Refactoring TestUninitVar. Added TODO test case.

This commit is contained in:
Daniel Marjamäki 2012-06-23 16:44:02 +02:00
parent 1e1b20d113
commit f59078fad9
1 changed files with 14 additions and 9 deletions

View File

@ -77,15 +77,6 @@ private:
}
void uninitvar1() {
// Ticket #3597
checkUninitVar("int f() {\n"
" int a;\n"
" int b = 1;\n"
" (b += a) = 1;\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: a\n","", errout.str());
// Ticket #2207 - False negative
checkUninitVar("void foo() {\n"
" int a;\n"
@ -269,6 +260,20 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
// Ticket #3597
checkUninitVar("int f() {\n"
" int a;\n"
" int b = 1;\n"
" (b += a) = 1;\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: a\n","", errout.str());
checkUninitVar("int f() {\n"
" int a,b,c;\n"
" a = b = c;\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: c\n", "", errout.str());
checkUninitVar("static void foo()\n"
"{\n"
" Foo p;\n"