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

Method testProblemsForIncludedFiles

plugins/clang/tests/test_problems.cpp:420–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420void TestProblems::testProblemsForIncludedFiles()
421{
422 TestFile header(QStringLiteral("#pragma once\n//TODO: header\n"), QStringLiteral("h"));
423 TestFile file("#include \"" + header.url().str() + "\"\n//TODO: source\n", QStringLiteral("cpp"));
424
425 file.parse(TopDUContext::AllDeclarationsContextsAndUses | TopDUContext::AST | TopDUContext::ForceUpdate);
426 QVERIFY(file.waitForParsed(5000));
427
428 {
429 DUChainReadLocker lock;
430 QVERIFY(file.topContext());
431
432 auto context = DUChain::self()->chainForDocument(file.url());
433 QVERIFY(context);
434 QCOMPARE(context->problems().size(), 1);
435 QCOMPARE(context->problems()[0]->description(), QStringLiteral("TODO: source"));
436 QCOMPARE(context->problems()[0]->finalLocation().document, file.url());
437
438 context = DUChain::self()->chainForDocument(header.url());
439 QVERIFY(context);
440 QCOMPARE(context->problems().size(), 1);
441 QCOMPARE(context->problems()[0]->description(), QStringLiteral("TODO: header"));
442 QCOMPARE(context->problems()[0]->finalLocation().document, header.url());
443 }
444}
445
446using RangeList = QVector<KTextEditor::Range>;
447

Callers

nothing calls this directly

Calls 10

strMethod · 0.80
waitForParsedMethod · 0.80
chainForDocumentMethod · 0.80
urlMethod · 0.45
parseMethod · 0.45
topContextMethod · 0.45
sizeMethod · 0.45
problemsMethod · 0.45
descriptionMethod · 0.45
finalLocationMethod · 0.45

Tested by

no test coverage detected