Added test case preprocessor_and_operation for ticket #55 (also fixed style from previous commit)
This commit is contained in:
parent
a0886e693e
commit
98d7f02ebc
|
@ -309,7 +309,7 @@ void Tokenizer::tokenize(std::istream &code, const char FileName[])
|
|||
|
||||
else if (strncmp(line.c_str(), "#endfile", 8) == 0)
|
||||
{
|
||||
if ( lineNumbers.empty() || fileIndexes.empty() )
|
||||
if (lineNumbers.empty() || fileIndexes.empty())
|
||||
{
|
||||
std::cerr << "####### Preprocessor bug! #######\n";
|
||||
std::exit(0);
|
||||
|
|
|
@ -89,7 +89,7 @@ private:
|
|||
TEST_CASE(preprocessor_include_in_str);
|
||||
// TODO TEST_CASE(fmt);
|
||||
TEST_CASE(multi_character_character);
|
||||
|
||||
// TODO TEST_CASE(preprocessor_and_operation);
|
||||
}
|
||||
|
||||
|
||||
|
@ -651,6 +651,23 @@ private:
|
|||
ASSERT_EQUALS("\nint main()\n{\nif( 'ABCD' == 0 );\nreturn 0;\n}\n", actual[""]);
|
||||
}
|
||||
|
||||
void preprocessor_and_operation()
|
||||
{
|
||||
const char filedata[] = "#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)\n"
|
||||
"#file \"kr.h\"\n"
|
||||
"#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)\n"
|
||||
"#endif\n"
|
||||
"#endfile\n"
|
||||
"#endif\n";
|
||||
|
||||
// Preprocess => actual result..
|
||||
Preprocessor preprocessor;
|
||||
std::string result = preprocessor.getcode(filedata, "");
|
||||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS("\n#file \"kr.h\"\n\n\n#endfile\n\n", result);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue