testmemleak : added a unit test that ensures that the variable id handling works correctly. But it's currently not working, and therefore it's commented out

This commit is contained in:
Daniel Marjamäki 2008-12-09 07:27:11 +00:00
parent f839b11c11
commit 68bcdb103c
1 changed files with 20 additions and 2 deletions

View File

@ -41,7 +41,8 @@ private:
// Tokenize.. // Tokenize..
Tokenizer tokenizer; Tokenizer tokenizer;
std::istringstream istr(code); std::istringstream istr(code);
tokenizer.tokenize( istr, "test.cpp" ); tokenizer.tokenize( istr, "test.cpp" );
tokenizer.setVarId();
tokenizer.simplifyTokenList(); tokenizer.simplifyTokenList();
// Clear the error buffer.. // Clear the error buffer..
@ -127,7 +128,9 @@ private:
TEST_CASE( realloc1 ); TEST_CASE( realloc1 );
TEST_CASE( realloc2 ); TEST_CASE( realloc2 );
TEST_CASE( assign ); TEST_CASE( assign );
// TODO TEST_CASE( varid );
} }
@ -1024,6 +1027,21 @@ private:
ASSERT_EQUALS( std::string(""), errout.str() ); ASSERT_EQUALS( std::string(""), errout.str() );
} }
void varid()
{
check( "void foo()\n"
"{\n"
" char *p = malloc(100);\n"
" {\n"
" char *p = 0;\n"
" delete p;\n"
" }\n"
" free(p);\n"
"}\n" );
ASSERT_EQUALS( std::string(""), errout.str() );
}
}; };