Commit cd6bd3c4 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Clang: Move completion test

Change-Id: I61cd72c131407415732ed1231a4614be57c1454b
Reviewed-by: Marco Bubke's avatarMarco Bubke <marco.bubke@qt.io>
parent 706da247
......@@ -30,6 +30,8 @@
using namespace ClangBackEnd;
using testing::_;
using testing::Eq;
using testing::Property;
namespace {
......@@ -70,6 +72,21 @@ TEST_F(CompleteCodeJob, SendAnnotations)
ASSERT_TRUE(waitUntilJobFinished(job));
}
TEST_F(CompleteCodeJob, ForwardTicketNumber)
{
jobRequest.ticketNumber = static_cast<quint64>(99);
jobContextWithMockClient = JobContext(jobRequest, &documents, &unsavedFiles, &mockIpcClient);
job.setContext(jobContextWithMockClient);
job.prepareAsyncRun();
EXPECT_CALL(mockIpcClient,
codeCompleted(Property(&CodeCompletedMessage::ticketNumber, Eq(99))))
.Times(1);
job.runAsync();
ASSERT_TRUE(waitUntilJobFinished(job));
}
TEST_F(CompleteCodeJob, DontSendCompletionsIfDocumentWasClosed)
{
job.setContext(jobContextWithMockClient);
......
......@@ -142,7 +142,6 @@ protected:
void expectCompletionFromFileBEnabledByMacro();
void expectCompletionFromFileAUnsavedMethodVersion1();
void expectCompletionFromFileAUnsavedMethodVersion2();
void expectCompletionWithTicketNumber(quint64 ticketNumber);
void expectNoCompletionWithUnsavedMethod();
void expectDocumentAnnotationsChangedForFileBWithSpecificHighlightingMark();
......@@ -260,15 +259,6 @@ TEST_F(ClangCodeModelServerSlowTest, GetNewCodeCompletionAfterUpdatingUnsavedFil
completeCodeInFileA();
}
TEST_F(ClangCodeModelServerSlowTest, TicketNumberIsForwarded)
{
registerProjectAndFile(filePathA, 1);
const CompleteCodeMessage message(filePathA, 20, 1, projectPartId);
expectCompletionWithTicketNumber(message.ticketNumber());
clangServer.completeCode(message);
}
TEST_F(ClangCodeModelServerSlowTest, TranslationUnitAfterCreationIsNotDirty)
{
registerProjectAndFile(filePathA, 1);
......@@ -510,14 +500,6 @@ void ClangCodeModelServer::expectCompletionFromFileAUnsavedMethodVersion2()
expectCompletion(completion);
}
void ClangCodeModelServer::expectCompletionWithTicketNumber(quint64 ticketNumber)
{
EXPECT_CALL(mockClangCodeModelClient,
codeCompleted(Property(&CodeCompletedMessage::ticketNumber,
Eq(ticketNumber))))
.Times(1);
}
void ClangCodeModelServer::expectNoCompletionWithUnsavedMethod()
{
const CodeCompletion completion(Utf8StringLiteral("Method2"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment