| 418 | } |
| 419 | |
| 420 | void 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 | |
| 446 | using RangeList = QVector<KTextEditor::Range>; |
| 447 |
nothing calls this directly
no test coverage detected