unused private function: Added test1 (assert that error message is given for simple case)
This commit is contained in:
parent
f347efd802
commit
57c144a342
|
@ -43,14 +43,14 @@ private:
|
|||
{
|
||||
// Tokenize..
|
||||
tokens = tokens_back = NULL;
|
||||
std::istringstream istr(code);
|
||||
std::istringstream istr(code);
|
||||
Tokenizer tokenizer;
|
||||
tokenizer.TokenizeCode( istr );
|
||||
|
||||
// Clear the error buffer..
|
||||
errout.str("");
|
||||
|
||||
// Check for unused private functions..
|
||||
// Check for unused private functions..
|
||||
CheckClass checkClass;
|
||||
checkClass.CheckUnusedPrivateFunctions();
|
||||
|
||||
|
@ -64,11 +64,18 @@ private:
|
|||
check( "class Fred\n"
|
||||
"{\n"
|
||||
"private:\n"
|
||||
" unsigned int f()\n"
|
||||
" { }\n"
|
||||
"};\n" );
|
||||
// Todo: This should be detected.
|
||||
ASSERT_EQUALS( std::string(""), errout.str() );
|
||||
" unsigned int f();\n"
|
||||
"public:\n"
|
||||
" Fred();\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"unsigned int Fred::Fred()\n"
|
||||
"{ }\n"
|
||||
"\n"
|
||||
"unsigned int Fred::f()\n"
|
||||
"{ }\n" );
|
||||
|
||||
ASSERT_EQUALS( std::string("Class 'Fred', unused private function: 'f'\n"), errout.str() );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue