Refactorizations in testrunner:

- Removed unnecessary space characters
- Removed comments from test cases which are not preprocessed
This commit is contained in:
PKEuS 2012-07-16 05:02:33 -07:00
parent 7d33181fba
commit 2103811291
4 changed files with 18 additions and 23 deletions

View File

@ -673,7 +673,7 @@ private:
"static void f()\n"
"{\n"
" char str[5];\n"
" memclr( str ); // ERROR\n"
" memclr( str );\n"
"}\n");
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Array 'str[5]' accessed at index 10, which is out of bounds.\n", errout.str());
@ -685,7 +685,7 @@ private:
"static void f()\n"
"{\n"
" char str[5];\n"
" memclr( 0, str ); // ERROR\n"
" memclr( 0, str );\n"
"}\n");
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Array 'str[5]' accessed at index 10, which is out of bounds.\n", errout.str());
@ -697,7 +697,7 @@ private:
"static void f()\n"
"{\n"
" char str[5];\n"
" memclr( 10, str ); // ERROR\n"
" memclr( 10, str );\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (possible error) Array index out of bounds.\n",
"", errout.str());
@ -712,7 +712,7 @@ private:
"static void f()\n"
"{\n"
" char str[5];\n"
" memclr( str, 5 ); // ERROR\n"
" memclr( str, 5 );\n"
"}\n");
ASSERT_EQUALS("", errout.str());

View File

@ -4104,7 +4104,7 @@ private:
" std::map<unsigned int,unsigned int> _hash;\n"
" public:\n"
" A() : _hash() {}\n"
" unsigned int fetch(unsigned int key) // cannot be 'const'\n"
" unsigned int fetch(unsigned int key)\n" // cannot be 'const'
" {\n"
" return _hash[key];\n"
" }\n"

View File

@ -3730,19 +3730,14 @@ private:
}
void trac1949() {
check("\n"
"\n"
"int fn()\n"
check("int fn()\n"
"{\n"
"char * buff = new char[100];\n"
"assert (buff);\n"
"\n"
"\n"
"\n"
"return 0;\n"
"}\n"
" char * buff = new char[100];\n"
" assert (buff);\n"
" return 0;\n"
"}"
);
ASSERT_EQUALS("[test.cpp:10]: (error) Memory leak: buff\n", errout.str());
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: buff\n", errout.str());
}
void trac2540() {

View File

@ -1489,24 +1489,24 @@ private:
void localvar44() { // ticket #3602 (false positive)
functionVariableUsage("void bar()\n"
"{ \n"
"{\n"
" int * piArray = NULL;\n"
" unsigned int uiArrayLength = 2048;\n"
" unsigned int uiIndex;\n"
" // Allocate memory\n"
"\n"
" try\n"
" {\n"
" piArray = new int[uiArrayLength];\n"
" piArray = new int[uiArrayLength];\n" // Allocate memory
" }\n"
" catch (...)\n"
" {\n"
" SOME_MACRO\n"
" delete [] piArray;\n"
" return;\n"
" SOME_MACRO\n"
" delete [] piArray;\n"
" return;\n"
" }\n"
" for (uiIndex = 0; uiIndex < uiArrayLength; uiIndex++)\n"
" {\n"
" piArray[uiIndex] = -1234;\n"
" piArray[uiIndex] = -1234;\n"
" }\n"
" delete [] piArray;\n"
" piArray = NULL;\n"