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

Method testReparseBaseClassesTemplates

plugins/clang/tests/test_duchain.cpp:723–750  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721}
722
723void TestDUChain::testReparseBaseClassesTemplates()
724{
725 TestFile file(QStringLiteral("template<typename T> struct a{}; struct b : a<int> {};\n"), QStringLiteral("cpp"));
726 file.parse(TopDUContext::AllDeclarationsContextsAndUses);
727
728 for (int i = 0; i < 2; ++i) {
729 qDebug() << "run: " << i;
730 QVERIFY(file.waitForParsed(500));
731 DUChainWriteLocker lock;
732 QVERIFY(file.topContext());
733 QCOMPARE(file.topContext()->childContexts().size(), 2);
734 QCOMPARE(file.topContext()->childContexts().first()->importers().size(), 1);
735 QCOMPARE(file.topContext()->childContexts().last()->importedParentContexts().size(), 1);
736
737 QCOMPARE(file.topContext()->localDeclarations().size(), 2);
738 auto aDecl = dynamic_cast<ClassDeclaration*>(file.topContext()->localDeclarations().first());
739 QVERIFY(aDecl);
740 QCOMPARE(aDecl->baseClassesSize(), 0u);
741 auto bDecl = dynamic_cast<ClassDeclaration*>(file.topContext()->localDeclarations().last());
742 QVERIFY(bDecl);
743 QCOMPARE(bDecl->baseClassesSize(), 1u);
744 int distance = 0;
745 QVERIFY(bDecl->isPublicBaseClass(aDecl, file.topContext(), &distance));
746 QCOMPARE(distance, 1);
747
748 file.parse(TopDUContext::AllDeclarationsContextsAndUses | TopDUContext::ForceUpdateRecursive);
749 }
750}
751
752void TestDUChain::testGetInheriters_data()
753{

Callers

nothing calls this directly

Calls 12

waitForParsedMethod · 0.80
childContextsMethod · 0.80
localDeclarationsMethod · 0.80
baseClassesSizeMethod · 0.80
isPublicBaseClassMethod · 0.80
parseMethod · 0.45
topContextMethod · 0.45
sizeMethod · 0.45
importersMethod · 0.45
firstMethod · 0.45
lastMethod · 0.45

Tested by

no test coverage detected