Added test case linenumbers2
This commit is contained in:
parent
10abbda6a7
commit
09c13d844e
|
@ -48,7 +48,8 @@ private:
|
|||
|
||||
void run()
|
||||
{
|
||||
// TEST_CASE(linenumbers);
|
||||
TEST_CASE(linenumbers);
|
||||
// TEST_CASE(linenumbers2);
|
||||
}
|
||||
|
||||
void linenumbers()
|
||||
|
@ -64,6 +65,21 @@ private:
|
|||
// Compare results..
|
||||
ASSERT_EQUALS("[file.cpp:5]: Using \"foo\" after it has been deallocated / released\n", errout.str());
|
||||
}
|
||||
|
||||
void linenumbers2()
|
||||
{
|
||||
const char filedata[] = "void f()\n"
|
||||
"{\n"
|
||||
" char *string;\n"
|
||||
" string = new char[20];\n"
|
||||
" string = new char[30];\n"
|
||||
" delete [] string;\n"
|
||||
"}\n";
|
||||
check(filedata);
|
||||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS("[file.cpp:5]: (always) Memory leak: string\n", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestCppcheck)
|
||||
|
|
Loading…
Reference in New Issue