From 09c13d844e72a9ace893406ab64032313985a838 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Thu, 5 Feb 2009 20:29:55 +0000 Subject: [PATCH] Added test case linenumbers2 --- test/testcppcheck.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/testcppcheck.cpp b/test/testcppcheck.cpp index 25dcba7f7..4f7326f30 100644 --- a/test/testcppcheck.cpp +++ b/test/testcppcheck.cpp @@ -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)