From 87fd55b155f2bcfbbb2c1de4eb91249bed9d764b Mon Sep 17 00:00:00 2001 From: Greg Hewgill Date: Tue, 1 Mar 2011 19:30:42 +1300 Subject: [PATCH] test case for #if 0 exclusion --- test/testpreprocessor.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 37df95c61..a16eccfd8 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -92,6 +92,8 @@ private: TEST_CASE(error3); + TEST_CASE(if0_exclude); + // Don't handle include in a #if 0 block TEST_CASE(if0_include_1); TEST_CASE(if0_include_2); @@ -641,6 +643,18 @@ private: ASSERT_EQUALS("[test.c:1]: (error) #error hello world!\n", errout.str()); } + void if0_exclude() + { + Settings settings; + Preprocessor preprocessor(&settings, this); + + std::istringstream code("#if 0\n" + "A\n" + "#endif\n" + "B\n"); + ASSERT_EQUALS("\n\n\nB\n", preprocessor.read(code,"",NULL)); + } + void if0_include_1() { Settings settings;