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

Method testBaseClasses

plugins/clang/tests/test_duchain.cpp:670–692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668}
669
670void TestDUChain::testBaseClasses()
671{
672 TestFile file(QStringLiteral("class Base {}; class Inherited : public Base {};"), QStringLiteral("cpp"));
673 QVERIFY(file.parseAndWait());
674
675 DUChainReadLocker lock;
676 DUContext* top = file.topContext().data();
677 QVERIFY(top);
678
679 QCOMPARE(top->localDeclarations().count(), 2);
680 Declaration* baseDecl = top->localDeclarations().first();
681 QCOMPARE(baseDecl->identifier(), Identifier(u"Base"));
682
683 ClassDeclaration* inheritedDecl = dynamic_cast<ClassDeclaration*>(top->localDeclarations()[1]);
684 QCOMPARE(inheritedDecl->identifier(), Identifier(u"Inherited"));
685
686 QVERIFY(inheritedDecl);
687 QCOMPARE(inheritedDecl->baseClassesSize(), 1u);
688
689 QCOMPARE(baseDecl->uses().count(), 1);
690 QCOMPARE(baseDecl->uses().first().count(), 1);
691 QCOMPARE(baseDecl->uses().first().first(), RangeInRevision(0, 40, 0, 44));
692}
693
694void TestDUChain::testReparseBaseClasses()
695{

Callers

nothing calls this directly

Calls 11

parseAndWaitMethod · 0.80
localDeclarationsMethod · 0.80
baseClassesSizeMethod · 0.80
IdentifierFunction · 0.50
RangeInRevisionClass · 0.50
dataMethod · 0.45
topContextMethod · 0.45
countMethod · 0.45
firstMethod · 0.45
identifierMethod · 0.45
usesMethod · 0.45

Tested by

no test coverage detected