diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 1dc7e93d2..8e3b21259 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -88,7 +88,8 @@ private: TEST_CASE(defdef); // Defined multiple times TEST_CASE(preprocessor_doublesharp); 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(stringify); @@ -634,7 +635,7 @@ private: - void fmt() + void fmt1() { const char filedata[] = "#define DBG(fmt...) printf(fmt)\n" "DBG(\"[0x%lx-0x%lx)\", pstart, pend);"; @@ -645,6 +646,21 @@ private: 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() { const char filedata[] = "#define FOO 'ABCD'\n"