testtokenize: updated 'TestTokenize::simplify_function_parameters'

This commit is contained in:
Daniel Marjamäki 2009-01-24 18:21:16 +00:00
parent 37ddf6a0a8
commit 8e7ff3bace
1 changed files with 22 additions and 0 deletions

View File

@ -749,6 +749,28 @@ private:
ostr << " " << tok->str();
ASSERT_EQUALS(std::string(" void f ( int x, char y ) { }"), ostr.str());
}
{
// This is not a function but the pattern is similar..
const char code[] = "void foo()\n"
"{\n"
" if (x)\n"
" int x;\n"
" { }\n"
"}\n";
// tokenize..
Tokenizer tokenizer;
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.simplifyTokenList();
std::ostringstream ostr;
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next())
ostr << " " << tok->str();
ASSERT_EQUALS(std::string(" void foo ( ) { if ( x ) int x ; { } }"), ostr.str());
}
}
};