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

Method testImplementAfterEdit

plugins/clang/tests/test_codecompletion.cpp:1068–1090  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1066}
1067
1068void TestCodeCompletion::testImplementAfterEdit()
1069{
1070 TestFile header1(QStringLiteral("void foo();"), QStringLiteral("h"));
1071 QVERIFY(header1.parseAndWait());
1072 TestFile impl(QString("#include \"%1\"\n"
1073 "void asdf() {}\nvoid bar() {}")
1074 .arg(header1.url().str()),
1075 QStringLiteral("cpp"), &header1);
1076
1077 auto document = ICore::self()->documentController()->openDocument(impl.url().toUrl());
1078
1079 QVERIFY(impl.parseAndWait(TopDUContext::AllDeclarationsContextsUsesAndAST));
1080
1081 CompletionItems expectedItems{{2,0}, {"foo()"}};
1082 executeCompletionTest(impl.topContext(), expectedItems);
1083
1084 document->textDocument()->insertText(expectedItems.position, QStringLiteral("\n"));
1085 expectedItems.position.setLine(3);
1086
1087 executeCompletionTest(impl.topContext(), expectedItems);
1088
1089 document->close(IDocument::Discard);
1090}
1091
1092void TestCodeCompletion::testInvalidCompletions()
1093{

Callers

nothing calls this directly

Calls 12

executeCompletionTestFunction · 0.85
parseAndWaitMethod · 0.80
strMethod · 0.80
documentControllerMethod · 0.80
QStringClass · 0.50
urlMethod · 0.45
openDocumentMethod · 0.45
toUrlMethod · 0.45
topContextMethod · 0.45
textDocumentMethod · 0.45
setLineMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected