Commit 8d23d801 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

Clang: Clear the project part completely on remove



Change-Id: I6fdb1766a3b407fbaaf86b0216a0dd710673aec1
Reviewed-by: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent f77f6e21
......@@ -98,9 +98,11 @@ ProjectPart &ProjectPart::operator=(ProjectPart &&other)
return *this;
}
void ProjectPart::clearProjectPartId()
void ProjectPart::clear()
{
d->projectPartId.clear();
d->clearArguments();
updateLastChangeTimePoint();
}
const Utf8String &ProjectPart::projectPartId() const
......
......@@ -58,7 +58,7 @@ public:
ProjectPart(ProjectPart &&project);
ProjectPart &operator=(ProjectPart &&project);
void clearProjectPartId();
void clear();
const Utf8String &projectPartId() const;
......
......@@ -51,7 +51,7 @@ void ProjectParts::remove(const Utf8StringVector &projectPartIds)
const bool isRemoved = processedProjectPartFilePaths.removeFast(project.projectPartId());
if (isRemoved)
project.clearProjectPartId();
project.clear();
return isRemoved;
});
......
......@@ -165,16 +165,20 @@ TEST(ProjectPart, ThrowsForNotExistingProjectPartButRemovesAllExistingProject)
ASSERT_THAT(projects.projects(), Not(Contains(project)));
}
TEST(ProjectPart, ProjectPartIdIsEmptyAfterRemove)
TEST(ProjectPart, ProjectPartIsClearedAfterRemove)
{
ClangBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral("pathToProjectPart.pro"));
ClangBackEnd::ProjectParts projects;
projects.createOrUpdate({projectContainer});
ClangBackEnd::ProjectPart project = *projects.findProjectPart(projectContainer.projectPartId());
const auto lastChangeTimePoint = project.lastChangeTimePoint();
std::this_thread::sleep_for(std::chrono::steady_clock::duration(1));
projects.remove({projectContainer.projectPartId()});
ASSERT_THAT(project.projectPartId(), Utf8String());
ASSERT_THAT(project.argumentCount(), 0);
ASSERT_THAT(project.lastChangeTimePoint(), Gt(lastChangeTimePoint));
}
TEST(ProjectPart, HasProjectPart)
......
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