Skip to content

Commit e3c6d71

Browse files
committed
add test
1 parent f6947eb commit e3c6d71

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

test.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4026,6 +4026,27 @@ static void ifCond()
40264026
ASSERT_EQUALS("0", it->E);
40274027
ASSERT_EQUALS(0, it->result);
40284028
}
4029+
{
4030+
const char code[] = "#ifdef NOTDEFINED\n"
4031+
"#endif\n"
4032+
"#ifndef NOTDEFINED\n"
4033+
"#endif\n";
4034+
std::list<simplecpp::IfCond> ifCond;
4035+
ASSERT_EQUALS("", preprocess(code, &ifCond));
4036+
ASSERT_EQUALS(2, ifCond.size());
4037+
auto it = ifCond.cbegin();
4038+
ASSERT_EQUALS(0, it->location.fileIndex);
4039+
ASSERT_EQUALS(1, it->location.line);
4040+
ASSERT_EQUALS(2, it->location.col);
4041+
ASSERT_EQUALS("0", it->E);
4042+
ASSERT_EQUALS(0, it->result);
4043+
++it;
4044+
ASSERT_EQUALS(0, it->location.fileIndex);
4045+
ASSERT_EQUALS(3, it->location.line);
4046+
ASSERT_EQUALS(2, it->location.col);
4047+
ASSERT_EQUALS("1", it->E);
4048+
ASSERT_EQUALS(1, it->result);
4049+
}
40294050
}
40304051

40314052
static void macroUsage()

0 commit comments

Comments
 (0)