@@ -331,6 +331,9 @@ class TestSymbolDatabase: public TestFixture {
331331 TEST_CASE (auto7);
332332 TEST_CASE (auto8);
333333 TEST_CASE (auto9); // #8044 (segmentation fault)
334+
335+ TEST_CASE (macroFuncionTest1);
336+ TEST_CASE (macroFuncionTest2);
334337 }
335338
336339 void array () {
@@ -5185,6 +5188,42 @@ class TestSymbolDatabase: public TestFixture {
51855188 ASSERT_EQUALS (true , db != nullptr ); // not null
51865189 }
51875190
5191+ void macroFuncionTest1 () {
5192+ GET_SYMBOL_DB (" class MacroTest\n {"
5193+ " public:\n "
5194+ " SOME_MACRO_WITH_NO_SEMICOLON()\n "
5195+ " void Init() { }\n "
5196+ " };\n " );
5197+
5198+ // 3 scopes: Global, Class, and Function
5199+ ASSERT (db && db->scopeList .size () == 3 );
5200+
5201+ if (!db)
5202+ return ;
5203+
5204+ const Scope *scope = db->findScopeByName (" MacroTest" );
5205+ ASSERT (scope && scope->functionList .size () == 1 );
5206+ ASSERT (findFunctionByName (" Init" , scope) != NULL );
5207+ }
5208+
5209+ void macroFuncionTest2 () {
5210+ GET_SYMBOL_DB (" class MacroTest\n {"
5211+ " public:\n "
5212+ " SOME_MACRO_WITH_NO_SEMICOLON(1, 2, 3)\n "
5213+ " void Init() { }\n "
5214+ " };\n " );
5215+
5216+ // 3 scopes: Global, Class, and Function
5217+ ASSERT (db && db->scopeList .size () == 3 );
5218+
5219+ if (!db)
5220+ return ;
5221+
5222+ const Scope *scope = db->findScopeByName (" MacroTest" );
5223+ ASSERT (scope && scope->functionList .size () == 1 );
5224+ ASSERT (findFunctionByName (" Init" , scope) != NULL );
5225+ }
5226+
51885227};
51895228
51905229REGISTER_TEST (TestSymbolDatabase)
0 commit comments