added unittest to fix sample code #3721

This commit is contained in:
Ettl Martin 2012-04-22 17:28:27 +02:00
parent 706631f527
commit d0b7a3514b
1 changed files with 13 additions and 0 deletions

View File

@ -251,6 +251,7 @@ private:
TEST_CASE(macrodoublesharp); TEST_CASE(macrodoublesharp);
TEST_CASE(simplifyFunctionParameters); TEST_CASE(simplifyFunctionParameters);
TEST_CASE(simplifyFunctionParameters1); // #3721
TEST_CASE(simplifyFunctionParametersErrors); TEST_CASE(simplifyFunctionParametersErrors);
TEST_CASE(removeParentheses1); // Ticket #61 TEST_CASE(removeParentheses1); // Ticket #61
@ -4082,6 +4083,18 @@ private:
} }
} }
void simplifyFunctionParameters1() { // ticket #3721
const char code[] = "typedef float ufloat;\n"
"typedef short ftnlen;\n"
"int f(p,w,d,e,len) ufloat *p; ftnlen len;\n"
"{\n"
"}\n";
ASSERT_EQUALS("int f ( float * p , int w , int d , int e , short len )\n"
"{\n"
"}", tokenizeAndStringify(code,true));
}
void simplifyFunctionParametersErrors() { void simplifyFunctionParametersErrors() {
//same parameters... //same parameters...
tokenizeAndStringify("void foo(x, x)\n" tokenizeAndStringify("void foo(x, x)\n"