test case for #if 0 exclusion

This commit is contained in:
Greg Hewgill 2011-03-01 19:30:42 +13:00
parent 92efbd748e
commit 87fd55b155
1 changed files with 14 additions and 0 deletions

View File

@ -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;