preprocessor: Added testcase fmt2 that is commented out because it doesn't work yet
This commit is contained in:
parent
3776db575c
commit
e9d19840d2
|
@ -88,7 +88,8 @@ private:
|
||||||
TEST_CASE(defdef); // Defined multiple times
|
TEST_CASE(defdef); // Defined multiple times
|
||||||
TEST_CASE(preprocessor_doublesharp);
|
TEST_CASE(preprocessor_doublesharp);
|
||||||
TEST_CASE(preprocessor_include_in_str);
|
TEST_CASE(preprocessor_include_in_str);
|
||||||
// TODO TEST_CASE(fmt);
|
// TODO TEST_CASE(fmt1);
|
||||||
|
// TODO TEST_CASE(fmt2);
|
||||||
TEST_CASE(multi_character_character);
|
TEST_CASE(multi_character_character);
|
||||||
|
|
||||||
TEST_CASE(stringify);
|
TEST_CASE(stringify);
|
||||||
|
@ -634,7 +635,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void fmt()
|
void fmt1()
|
||||||
{
|
{
|
||||||
const char filedata[] = "#define DBG(fmt...) printf(fmt)\n"
|
const char filedata[] = "#define DBG(fmt...) printf(fmt)\n"
|
||||||
"DBG(\"[0x%lx-0x%lx)\", pstart, pend);";
|
"DBG(\"[0x%lx-0x%lx)\", pstart, pend);";
|
||||||
|
@ -645,6 +646,21 @@ private:
|
||||||
ASSERT_EQUALS("\nprintf(\"[0x%lx-0x%lx)\", pstart, pend);", actual);
|
ASSERT_EQUALS("\nprintf(\"[0x%lx-0x%lx)\", pstart, pend);", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fmt2()
|
||||||
|
{
|
||||||
|
const char filedata[] = "#define DBG(fmt, args...) printf(fmt, ## args)\n"
|
||||||
|
"DBG(\"hello\");";
|
||||||
|
|
||||||
|
// Preprocess..
|
||||||
|
std::string actual = Preprocessor::expandMacros(filedata);
|
||||||
|
|
||||||
|
ASSERT_EQUALS("\nprintf(\"hello\");", actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void multi_character_character()
|
void multi_character_character()
|
||||||
{
|
{
|
||||||
const char filedata[] = "#define FOO 'ABCD'\n"
|
const char filedata[] = "#define FOO 'ABCD'\n"
|
||||||
|
|
Loading…
Reference in New Issue