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

Method testSameFunctionDefinition

plugins/clang/tests/test_duchain.cpp:2441–2481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2439}
2440
2441void TestDUChain::testSameFunctionDefinition()
2442{
2443 QString source(QStringLiteral(R"(
2444 #include <stdio.h>
2445 #include <stdlib.h>
2446
2447 void configure()
2448 {
2449 printf("do stuff\n");
2450 }
2451 )"));
2452
2453 QTemporaryDir dir;
2454 auto project = new TestProject(Path(dir.path()), this);
2455 m_projectController->addProject(project);
2456
2457 TestFile file1(source, QStringLiteral("c"), project);
2458 TestFile file2(source, QStringLiteral("c"), project);
2459 TestFile file3(source, QStringLiteral("c"), project);
2460
2461 file1.parse(TopDUContext::AllDeclarationsContextsAndUses);
2462 file2.parse(TopDUContext::AllDeclarationsContextsAndUses);
2463 file3.parse(TopDUContext::AllDeclarationsContextsAndUses);
2464
2465 QVERIFY(file1.waitForParsed(1000));
2466 QVERIFY(file2.waitForParsed(1000));
2467 QVERIFY(file3.waitForParsed(1000));
2468
2469 auto checkFunctionDefinition = [] (TestFile & file) {
2470 DUChainReadLocker lock;
2471 QCOMPARE(file.topContext()->localDeclarations().count(), 1);
2472 auto configureFunc = file.topContext()->localDeclarations().first();
2473 QCOMPARE(FunctionDefinition::definition(configureFunc), configureFunc);
2474 };
2475
2476 checkFunctionDefinition(file1);
2477 checkFunctionDefinition(file2);
2478 checkFunctionDefinition(file3);
2479
2480 m_projectController->closeAllProjects();
2481}
2482
2483void TestDUChain::testSizeAlignOf()
2484{

Callers

nothing calls this directly

Calls 10

waitForParsedMethod · 0.80
localDeclarationsMethod · 0.80
closeAllProjectsMethod · 0.80
PathClass · 0.50
pathMethod · 0.45
addProjectMethod · 0.45
parseMethod · 0.45
countMethod · 0.45
topContextMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected