Added test case for preprocessor which currently fails. codeblocks project file updated, tools-files added.
This commit is contained in:
parent
46f4701c26
commit
c7730044c7
|
@ -81,6 +81,12 @@
|
|||
<Unit filename="test/testtokenize.cpp" />
|
||||
<Unit filename="test/testunusedprivfunc.cpp" />
|
||||
<Unit filename="test/testunusedvar.cpp" />
|
||||
<Unit filename="tools/dmake.cpp">
|
||||
<Option target="<{~None~}>" />
|
||||
</Unit>
|
||||
<Unit filename="tools/errmsg.cpp">
|
||||
<Option target="<{~None~}>" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<debugger />
|
||||
|
|
|
@ -70,6 +70,7 @@ private:
|
|||
TEST_CASE(macro_simple2);
|
||||
TEST_CASE(macro_mismatch);
|
||||
TEST_CASE(macro_multiline);
|
||||
TEST_CASE(preprocessor_inside_string);
|
||||
}
|
||||
|
||||
|
||||
|
@ -434,7 +435,23 @@ private:
|
|||
ASSERT_EQUALS("\n\n5*5;\n", Preprocessor::expandMacros(filedata));
|
||||
}
|
||||
|
||||
void preprocessor_inside_string()
|
||||
{
|
||||
const char filedata[] = "int main()"
|
||||
"{"
|
||||
" const char *a = \"#define A\n\";"
|
||||
"}";
|
||||
|
||||
// Preprocess => actual result..
|
||||
std::istringstream istr(filedata);
|
||||
std::map<std::string, std::string> actual;
|
||||
Preprocessor preprocessor;
|
||||
preprocessor.preprocess(istr, actual);
|
||||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS(1, actual.size());
|
||||
ASSERT_EQUALS("int main(){ const char *a = \"#define A\n\";}\n", actual[""]);
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestPreprocessor)
|
||||
|
|
Loading…
Reference in New Issue