Added test case for #147 (Invalid line number for error message)

http://apps.sourceforge.net/trac/cppcheck/ticket/147
macro_linenumbers() in test/testpreprocessor.cpp
This commit is contained in:
Reijo Tomperi 2009-03-08 22:28:12 +02:00
parent de1a786a07
commit 1c626c53c2
1 changed files with 16 additions and 0 deletions

View File

@ -95,6 +95,7 @@ private:
TEST_CASE(macro_simple7); TEST_CASE(macro_simple7);
TEST_CASE(macro_simple8); TEST_CASE(macro_simple8);
TEST_CASE(macro_mismatch); TEST_CASE(macro_mismatch);
// TODO TEST_CASE(macro_linenumbers);
TEST_CASE(string1); TEST_CASE(string1);
TEST_CASE(string2); TEST_CASE(string2);
TEST_CASE(preprocessor_undef); TEST_CASE(preprocessor_undef);
@ -587,6 +588,21 @@ private:
ASSERT_EQUALS("\nAAA(5);\n", OurPreprocessor::expandMacros(filedata)); ASSERT_EQUALS("\nAAA(5);\n", OurPreprocessor::expandMacros(filedata));
} }
void macro_linenumbers()
{
const char filedata[] = "#define AAA(a)\n"
"AAA(5\n"
"\n"
")\n"
"int a;\n";
ASSERT_EQUALS( "\n"
"\n"
"\n"
"\n"
"int a;\n",
OurPreprocessor::expandMacros(filedata));
}
void string1() void string1()
{ {
const char filedata[] = "int main()" const char filedata[] = "int main()"