aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2018-01-05 12:28:15 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2018-01-08 13:18:54 +0000
commite3b1259004a8616d045ce42e6cb5a5c5382bca4c (patch)
treef2721fc21c5c61e9781e96e48def639ffa64b4db /tests
parent063b327097c8e45d12e22ab4ef22d04384c7b906 (diff)
Clang: Introduce DocumentParsed as job requirement
This is in prepration for a follow-up change, which introduces a state where the Document is not yet parsed (it was reset) but the queue has jobs. All jobs get this requirement except those that generate an AST. Change-Id: Ifcbb704e54108b40797180514c5ad3f3768ef10b Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/unittest/clangjobqueue-test.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/unit/unittest/clangjobqueue-test.cpp b/tests/unit/unittest/clangjobqueue-test.cpp
index 202e9762ab..b9c336551f 100644
--- a/tests/unit/unittest/clangjobqueue-test.cpp
+++ b/tests/unit/unittest/clangjobqueue-test.cpp
@@ -66,6 +66,8 @@ protected:
PreferredTranslationUnit preferredTranslationUnit
= PreferredTranslationUnit::RecentlyParsed) const;
+ void pretendParsedTranslationUnit();
+
void updateDocumentRevision();
void updateUnsavedFiles();
void updateProject();
@@ -173,7 +175,7 @@ TEST_F(JobQueue, ProcessSingleJob)
TEST_F(JobQueue, ProcessUntilEmpty)
{
jobQueue.add(createJobRequest(filePath1, JobRequest::Type::UpdateDocumentAnnotations));
- jobQueue.add(createJobRequest(filePath1, JobRequest::Type::CreateInitialDocumentPreamble));
+ jobQueue.add(createJobRequest(filePath1, JobRequest::Type::ParseSupportiveTranslationUnit));
JobRequests jobsToRun;
ASSERT_THAT(jobQueue.size(), Eq(2));
@@ -421,6 +423,7 @@ TEST_F(JobQueue, RequestCompleteCodeOutdatableByDocumentClose)
TEST_F(JobQueue, RequestCompleteCodeNotOutdatableByUnsavedFilesChange)
{
+ pretendParsedTranslationUnit();
jobQueue.add(createJobRequest(filePath1, JobRequest::Type::CompleteCode));
updateUnsavedFiles();
@@ -431,6 +434,7 @@ TEST_F(JobQueue, RequestCompleteCodeNotOutdatableByUnsavedFilesChange)
TEST_F(JobQueue, RequestCompleteCodeNotOutdatableByDocumentRevisionChange)
{
+ pretendParsedTranslationUnit();
jobQueue.add(createJobRequest(filePath1, JobRequest::Type::CompleteCode));
updateDocumentRevision();
@@ -461,6 +465,7 @@ TEST_F(JobQueue, RequestCompleteCodeOutdatableByDocumentRevisionChange)
TEST_F(JobQueue, RequestReferencesRunsForCurrentDocumentRevision)
{
+ pretendParsedTranslationUnit();
jobQueue.add(createJobRequest(filePath1, JobRequest::Type::RequestReferences));
const JobRequests jobsToStart = jobQueue.processQueue();
@@ -549,6 +554,11 @@ JobRequest JobQueue::createJobRequest(
return jobRequest;
}
+void JobQueue::pretendParsedTranslationUnit()
+{
+ document.translationUnits().updateParseTimePoint(document.translationUnit().id(), Clock::now());
+}
+
void JobQueue::updateDocumentRevision()
{
documents.update({FileContainer(filePath1, projectPartId, Utf8String(), true, 1)});