File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
40314052static void macroUsage ()
You can’t perform that action at this time.
0 commit comments