From baf50c6db15585cfb5c6ec8ad68d2786b5387ff1 Mon Sep 17 00:00:00 2001 From: Greg Hewgill Date: Tue, 1 Mar 2011 20:17:54 +1300 Subject: [PATCH] add TODO for #elif inside #if 0 processing, also for #if 1 --- test/testpreprocessor.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 9b4fcf02f..bc1765840 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -95,6 +95,7 @@ private: TEST_CASE(if0_exclude); TEST_CASE(if0_whitespace); TEST_CASE(if0_else); + TEST_CASE(if0_elif); // Don't handle include in a #if 0 block TEST_CASE(if0_include_1); @@ -687,6 +688,30 @@ private: "#endif\n" "C\n"); ASSERT_EQUALS("#if 0\n\n#else\nB\n#endif\nC\n", preprocessor.read(code,"",NULL)); + + std::istringstream code2("#if 1\n" + "A\n" + "#else\n" + "B\n" + "#endif\n" + "C\n"); + TODO_ASSERT_EQUALS("#if 1\nA\n#else\n\n#endif\nC\n", + "#if 1\nA\n#else\nB\n#endif\nC\n", preprocessor.read(code2,"",NULL)); + } + + void if0_elif() + { + Settings settings; + Preprocessor preprocessor(&settings, this); + + std::istringstream code("#if 0\n" + "A\n" + "#elif 1\n" + "B\n" + "#endif\n" + "C\n"); + TODO_ASSERT_EQUALS("#if 0\n\n#elif 1\nB\n#endif\nC\n", + "#if 0\n\n\n\n#endif\nC\n", preprocessor.read(code,"",NULL)); } void if0_include_1()