Unit Testing: Added TODO test case for uninitialized member variable in operator=. Ticket: #1813

This commit is contained in:
Robert Reif 2010-06-25 07:56:40 +02:00 committed by Daniel Marjamäki
parent 38f90dae09
commit f3538dd574
1 changed files with 19 additions and 0 deletions

View File

@ -51,6 +51,7 @@ private:
TEST_CASE(uninitVar5);
TEST_CASE(uninitVar6);
TEST_CASE(uninitVar7);
TEST_CASE(uninitVar8);
TEST_CASE(uninitVarEnum);
TEST_CASE(uninitVarStream);
TEST_CASE(uninitVarTypedef);
@ -1561,6 +1562,24 @@ private:
ASSERT_EQUALS("", errout.str());
}
void uninitVar8()
{
checkUninitVar("class Foo {\n"
" int a;\n"
"public:\n"
" Foo() : a(0) {}\n"
" Foo& operator=(const Foo&);\n"
"};\n"
"\n"
"Foo& Foo::operator=(const Foo& rhs) {\n"
" if (&rhs != this)\n"
" {\n"
" }\n"
" return *this;\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:8]: (style) Member variable 'Foo::a' is not assigned a value in 'Foo::operator='\n", errout.str());
}
void uninitVarArray1()
{
checkUninitVar("class John\n"