| 721 | } |
| 722 | |
| 723 | void 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 | |
| 752 | void TestDUChain::testGetInheriters_data() |
| 753 | { |
nothing calls this directly
no test coverage detected