Test Memory leak: Added a test case, currently a false positive is generated

This commit is contained in:
Daniel Marjamäki 2008-11-29 16:42:14 +00:00
parent 87794cc66c
commit 8c07a13cb6
1 changed files with 25 additions and 14 deletions

View File

@ -113,6 +113,7 @@ private:
TEST_CASE( func5 ); TEST_CASE( func5 );
TEST_CASE( func6 ); TEST_CASE( func6 );
// TODO TEST_CASE( func7 ); // TODO TEST_CASE( func7 );
// TEST_CASE( func8 ); // Using callback
// TODO TEST_CASE( class1 ); // TODO TEST_CASE( class1 );
// TODO TEST_CASE( class2 ); // TODO TEST_CASE( class2 );
@ -799,11 +800,21 @@ private:
" foo(p);\n" " foo(p);\n"
"}\n" ); "}\n" );
std::string err( errout.str() ); std::string err( errout.str() );
std::cout << err << "\n";
ASSERT_EQUALS( std::string("[test.cpp:11]: Memory leak: p\n"), err ); ASSERT_EQUALS( std::string("[test.cpp:11]: Memory leak: p\n"), err );
} }
void func8()
{
check( "static void foo()\n"
"{\n"
" char *str = new char[100];"
" (*release)(str);\n"
"}\n" );
ASSERT_EQUALS( std::string(""), errout.str() );
}
/* /*
void func3() void func3()