Test case for Ticket #32
This commit is contained in:
parent
b9b250f4cc
commit
f6452e3613
|
@ -43,6 +43,9 @@ private:
|
||||||
TEST_CASE(virtualDestructor5); // Derived class has empty destructor => no error
|
TEST_CASE(virtualDestructor5); // Derived class has empty destructor => no error
|
||||||
|
|
||||||
TEST_CASE(uninitVar1);
|
TEST_CASE(uninitVar1);
|
||||||
|
|
||||||
|
// TODO, cppcheck currently produces false positive, this should be fixed
|
||||||
|
// TEST_CASE(uninitVarStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that base classes have virtual destructors
|
// Check that base classes have virtual destructors
|
||||||
|
@ -165,6 +168,18 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:10]: Uninitialized member variable 'Fred::_code'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:10]: Uninitialized member variable 'Fred::_code'\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uninitVarStream()
|
||||||
|
{
|
||||||
|
checkUninitVar("#include <fstream>\n"
|
||||||
|
"class Foo {\n"
|
||||||
|
"int foo;\n"
|
||||||
|
"public:\n"
|
||||||
|
"Foo(std::istream &in) { if(!(in >> foo)) throw 0; }\n"
|
||||||
|
"};\n");
|
||||||
|
|
||||||
|
ASSERT_EQUALS(std::string(""), errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TEST(TestClass)
|
REGISTER_TEST(TestClass)
|
||||||
|
|
Loading…
Reference in New Issue