Added test case linenumbers2

This commit is contained in:
Reijo Tomperi 2009-02-05 20:29:55 +00:00
parent 10abbda6a7
commit 09c13d844e
1 changed files with 17 additions and 1 deletions

View File

@ -48,7 +48,8 @@ private:
void run() void run()
{ {
// TEST_CASE(linenumbers); TEST_CASE(linenumbers);
// TEST_CASE(linenumbers2);
} }
void linenumbers() void linenumbers()
@ -64,6 +65,21 @@ private:
// Compare results.. // Compare results..
ASSERT_EQUALS("[file.cpp:5]: Using \"foo\" after it has been deallocated / released\n", errout.str()); 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) REGISTER_TEST(TestCppcheck)