MCPcopy Create free account
hub / github.com/KDE/kdevelop / testMultiLineMacroRanges

Method testMultiLineMacroRanges

plugins/clang/tests/test_duchain.cpp:1504–1522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1502}
1503
1504void TestDUChain::testMultiLineMacroRanges()
1505{
1506 TestFile file(QStringLiteral("#define FUNC_MACROS(x) struct str##x{};\nFUNC_MACROS(x\n);"), QStringLiteral("cpp"));
1507 file.parse(TopDUContext::AllDeclarationsContextsAndUses);
1508 QVERIFY(file.waitForParsed(5000));
1509
1510 DUChainReadLocker lock;
1511 QVERIFY(file.topContext());
1512 QCOMPARE(file.topContext()->localDeclarations().size(), 2);
1513 auto macroDefinition = file.topContext()->localDeclarations()[0];
1514 QVERIFY(macroDefinition);
1515 QCOMPARE(macroDefinition->range(), RangeInRevision(0,8,0,19));
1516 auto structDeclaration = file.topContext()->localDeclarations()[1];
1517 QVERIFY(structDeclaration);
1518 QCOMPARE(structDeclaration->range(), RangeInRevision(1,0,1,0));
1519
1520 QCOMPARE(macroDefinition->uses().size(), 1);
1521 QCOMPARE(macroDefinition->uses().begin()->first(), RangeInRevision(1,0,1,11));
1522}
1523
1524void TestDUChain::testNestedMacroRanges()
1525{

Callers

nothing calls this directly

Calls 10

waitForParsedMethod · 0.80
localDeclarationsMethod · 0.80
RangeInRevisionClass · 0.50
parseMethod · 0.45
topContextMethod · 0.45
sizeMethod · 0.45
rangeMethod · 0.45
usesMethod · 0.45
firstMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected