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

@ -42,6 +42,7 @@ private:
Tokenizer tokenizer;
std::istringstream istr(code);
tokenizer.tokenize( istr, "test.cpp" );
tokenizer.setVarId();
tokenizer.simplifyTokenList();
// Clear the error buffer..
@ -128,6 +129,8 @@ private:
TEST_CASE( realloc2 );
TEST_CASE( assign );
// TODO TEST_CASE( varid );
}
@ -1025,6 +1028,21 @@ private:
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() );
}
};
REGISTER_TEST( TestMemleak )