forked from qt-creator/qt-creator
Clang: More renaming fixes
Change-Id: If796869b26fc6faf5919041368fb26e8a42ae8a2 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -95,7 +95,7 @@ ClangCodeModelServer::ClangCodeModelServer()
|
|||||||
QObject::connect(documents.clangFileSystemWatcher(),
|
QObject::connect(documents.clangFileSystemWatcher(),
|
||||||
&ClangFileSystemWatcher::fileChanged,
|
&ClangFileSystemWatcher::fileChanged,
|
||||||
[this](const Utf8String &filePath) {
|
[this](const Utf8String &filePath) {
|
||||||
ClangCodeModelServer::startDocumentAnnotationsTimerIfFileIsNotATranslationUnit(filePath);
|
ClangCodeModelServer::startDocumentAnnotationsTimerIfFileIsNotOpenAsDocument(filePath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ void ClangCodeModelServer::updateTranslationUnitsForEditor(const UpdateTranslati
|
|||||||
}
|
}
|
||||||
} catch (const ProjectPartDoNotExistException &exception) {
|
} catch (const ProjectPartDoNotExistException &exception) {
|
||||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||||
} catch (const TranslationUnitDoesNotExistException &exception) {
|
} catch (const DocumentDoesNotExistException &exception) {
|
||||||
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
||||||
} catch (const std::exception &exception) {
|
} catch (const std::exception &exception) {
|
||||||
qWarning() << "Error in ClangCodeModelServer::updateTranslationUnitsForEditor:" << exception.what();
|
qWarning() << "Error in ClangCodeModelServer::updateTranslationUnitsForEditor:" << exception.what();
|
||||||
@@ -150,7 +150,7 @@ void ClangCodeModelServer::unregisterTranslationUnitsForEditor(const ClangBackEn
|
|||||||
try {
|
try {
|
||||||
documents.remove(message.fileContainers());
|
documents.remove(message.fileContainers());
|
||||||
unsavedFiles.remove(message.fileContainers());
|
unsavedFiles.remove(message.fileContainers());
|
||||||
} catch (const TranslationUnitDoesNotExistException &exception) {
|
} catch (const DocumentDoesNotExistException &exception) {
|
||||||
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
||||||
} catch (const ProjectPartDoNotExistException &exception) {
|
} catch (const ProjectPartDoNotExistException &exception) {
|
||||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||||
@@ -209,7 +209,7 @@ void ClangCodeModelServer::unregisterUnsavedFilesForEditor(const UnregisterUnsav
|
|||||||
try {
|
try {
|
||||||
unsavedFiles.remove(message.fileContainers());
|
unsavedFiles.remove(message.fileContainers());
|
||||||
documents.updateDocumentsWithChangedDependencies(message.fileContainers());
|
documents.updateDocumentsWithChangedDependencies(message.fileContainers());
|
||||||
} catch (const TranslationUnitDoesNotExistException &exception) {
|
} catch (const DocumentDoesNotExistException &exception) {
|
||||||
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
||||||
} catch (const ProjectPartDoNotExistException &exception) {
|
} catch (const ProjectPartDoNotExistException &exception) {
|
||||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||||
@@ -232,7 +232,7 @@ void ClangCodeModelServer::completeCode(const ClangBackEnd::CompleteCodeMessage
|
|||||||
|
|
||||||
jobs().add(jobRequest);
|
jobs().add(jobRequest);
|
||||||
jobs().process();
|
jobs().process();
|
||||||
} catch (const TranslationUnitDoesNotExistException &exception) {
|
} catch (const DocumentDoesNotExistException &exception) {
|
||||||
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
||||||
} catch (const ProjectPartDoNotExistException &exception) {
|
} catch (const ProjectPartDoNotExistException &exception) {
|
||||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||||
@@ -254,7 +254,7 @@ void ClangCodeModelServer::requestDocumentAnnotations(const RequestDocumentAnnot
|
|||||||
|
|
||||||
jobs().add(jobRequest);
|
jobs().add(jobRequest);
|
||||||
jobs().process();
|
jobs().process();
|
||||||
} catch (const TranslationUnitDoesNotExistException &exception) {
|
} catch (const DocumentDoesNotExistException &exception) {
|
||||||
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
||||||
} catch (const ProjectPartDoNotExistException &exception) {
|
} catch (const ProjectPartDoNotExistException &exception) {
|
||||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||||
@@ -281,7 +281,7 @@ const Documents &ClangCodeModelServer::documentsForTestOnly() const
|
|||||||
return documents;
|
return documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangCodeModelServer::startDocumentAnnotationsTimerIfFileIsNotATranslationUnit(const Utf8String &filePath)
|
void ClangCodeModelServer::startDocumentAnnotationsTimerIfFileIsNotOpenAsDocument(const Utf8String &filePath)
|
||||||
{
|
{
|
||||||
if (!documents.hasDocumentWithFilePath(filePath))
|
if (!documents.hasDocumentWithFilePath(filePath))
|
||||||
updateDocumentAnnotationsTimer.start(0);
|
updateDocumentAnnotationsTimer.start(0);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public /*for tests*/:
|
|||||||
private:
|
private:
|
||||||
Jobs &jobs();
|
Jobs &jobs();
|
||||||
|
|
||||||
void startDocumentAnnotationsTimerIfFileIsNotATranslationUnit(const Utf8String &filePath);
|
void startDocumentAnnotationsTimerIfFileIsNotOpenAsDocument(const Utf8String &filePath);
|
||||||
void addJobRequestsForDirtyAndVisibleDocuments();
|
void addJobRequestsForDirtyAndVisibleDocuments();
|
||||||
void processJobsForDirtyAndVisibleDocuments();
|
void processJobsForDirtyAndVisibleDocuments();
|
||||||
void processInitialJobsForDocuments(const std::vector<Document> &documents);
|
void processInitialJobsForDocuments(const std::vector<Document> &documents);
|
||||||
|
|||||||
@@ -359,13 +359,13 @@ void Document::setDirty()
|
|||||||
void Document::checkIfNull() const
|
void Document::checkIfNull() const
|
||||||
{
|
{
|
||||||
if (isNull())
|
if (isNull())
|
||||||
throw TranslationUnitIsNullException();
|
throw DocumentIsNullException();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::checkIfFileExists() const
|
void Document::checkIfFileExists() const
|
||||||
{
|
{
|
||||||
if (!fileExists())
|
if (!fileExists())
|
||||||
throw TranslationUnitFileNotExitsException(d->filePath);
|
throw DocumentFileDoesNotExistException(d->filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Document::fileExists() const
|
bool Document::fileExists() const
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ const Document &Documents::document(const Utf8String &filePath, const Utf8String
|
|||||||
auto findIterator = findDocument(filePath, projectPartId);
|
auto findIterator = findDocument(filePath, projectPartId);
|
||||||
|
|
||||||
if (findIterator == documents_.end())
|
if (findIterator == documents_.end())
|
||||||
throw TranslationUnitDoesNotExistException(FileContainer(filePath, projectPartId));
|
throw DocumentDoesNotExistException(FileContainer(filePath, projectPartId));
|
||||||
|
|
||||||
return *findIterator;
|
return *findIterator;
|
||||||
}
|
}
|
||||||
@@ -169,10 +169,10 @@ QVector<FileContainer> Documents::newerFileContainers(const QVector<FileContaine
|
|||||||
{
|
{
|
||||||
QVector<FileContainer> newerContainers;
|
QVector<FileContainer> newerContainers;
|
||||||
|
|
||||||
auto translationUnitIsNewer = [this] (const FileContainer &fileContainer) {
|
auto documentIsNewer = [this] (const FileContainer &fileContainer) {
|
||||||
try {
|
try {
|
||||||
return document(fileContainer).documentRevision() != fileContainer.documentRevision();
|
return document(fileContainer).documentRevision() != fileContainer.documentRevision();
|
||||||
} catch (const TranslationUnitDoesNotExistException &) {
|
} catch (const DocumentDoesNotExistException &) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -180,7 +180,7 @@ QVector<FileContainer> Documents::newerFileContainers(const QVector<FileContaine
|
|||||||
std::copy_if(fileContainers.cbegin(),
|
std::copy_if(fileContainers.cbegin(),
|
||||||
fileContainers.cend(),
|
fileContainers.cend(),
|
||||||
std::back_inserter(newerContainers),
|
std::back_inserter(newerContainers),
|
||||||
translationUnitIsNewer);
|
documentIsNewer);
|
||||||
|
|
||||||
return newerContainers;
|
return newerContainers;
|
||||||
}
|
}
|
||||||
@@ -280,7 +280,7 @@ void Documents::checkIfDocumentsDoNotExist(const QVector<FileContainer> &fileCon
|
|||||||
{
|
{
|
||||||
for (const FileContainer &fileContainer : fileContainers) {
|
for (const FileContainer &fileContainer : fileContainers) {
|
||||||
if (hasDocument(fileContainer))
|
if (hasDocument(fileContainer))
|
||||||
throw TranslationUnitAlreadyExistsException(fileContainer);
|
throw DocumentAlreadyExistsException(fileContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +288,7 @@ void Documents::checkIfDocumentsForFilePathsExist(const QVector<FileContainer> &
|
|||||||
{
|
{
|
||||||
for (const FileContainer &fileContainer : fileContainers) {
|
for (const FileContainer &fileContainer : fileContainers) {
|
||||||
if (!hasDocumentWithFilePath(fileContainer.filePath()))
|
if (!hasDocumentWithFilePath(fileContainer.filePath()))
|
||||||
throw TranslationUnitDoesNotExistException(fileContainer);
|
throw DocumentDoesNotExistException(fileContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ void Documents::removeDocuments(const QVector<FileContainer> &fileContainers)
|
|||||||
documents_.erase(removeBeginIterator, documents_.end());
|
documents_.erase(removeBeginIterator, documents_.end());
|
||||||
|
|
||||||
if (!processedFileContainers.isEmpty())
|
if (!processedFileContainers.isEmpty())
|
||||||
throw TranslationUnitDoesNotExistException(processedFileContainers.first());
|
throw DocumentDoesNotExistException(processedFileContainers.first());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
|||||||
@@ -48,25 +48,25 @@ const char *ProjectPartDoNotExistException::what() const Q_DECL_NOEXCEPT
|
|||||||
return what_.constData();
|
return what_.constData();
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitAlreadyExistsException::TranslationUnitAlreadyExistsException(
|
DocumentAlreadyExistsException::DocumentAlreadyExistsException(
|
||||||
const FileContainer &fileContainer)
|
const FileContainer &fileContainer)
|
||||||
: fileContainer_(fileContainer)
|
: fileContainer_(fileContainer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitAlreadyExistsException::TranslationUnitAlreadyExistsException(
|
DocumentAlreadyExistsException::DocumentAlreadyExistsException(
|
||||||
const Utf8String &filePath,
|
const Utf8String &filePath,
|
||||||
const Utf8String &projectPartId)
|
const Utf8String &projectPartId)
|
||||||
: fileContainer_(filePath, projectPartId)
|
: fileContainer_(filePath, projectPartId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileContainer &TranslationUnitAlreadyExistsException::fileContainer() const
|
const FileContainer &DocumentAlreadyExistsException::fileContainer() const
|
||||||
{
|
{
|
||||||
return fileContainer_;
|
return fileContainer_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *TranslationUnitAlreadyExistsException::what() const Q_DECL_NOEXCEPT
|
const char *DocumentAlreadyExistsException::what() const Q_DECL_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (what_.isEmpty()) {
|
if (what_.isEmpty()) {
|
||||||
what_ += Utf8StringLiteral("Translation unit '")
|
what_ += Utf8StringLiteral("Translation unit '")
|
||||||
@@ -79,25 +79,25 @@ const char *TranslationUnitAlreadyExistsException::what() const Q_DECL_NOEXCEPT
|
|||||||
return what_.constData();
|
return what_.constData();
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitDoesNotExistException::TranslationUnitDoesNotExistException(
|
DocumentDoesNotExistException::DocumentDoesNotExistException(
|
||||||
const FileContainer &fileContainer)
|
const FileContainer &fileContainer)
|
||||||
: fileContainer_(fileContainer)
|
: fileContainer_(fileContainer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitDoesNotExistException::TranslationUnitDoesNotExistException(
|
DocumentDoesNotExistException::DocumentDoesNotExistException(
|
||||||
const Utf8String &filePath,
|
const Utf8String &filePath,
|
||||||
const Utf8String &projectPartId)
|
const Utf8String &projectPartId)
|
||||||
: fileContainer_(filePath, projectPartId)
|
: fileContainer_(filePath, projectPartId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileContainer &TranslationUnitDoesNotExistException::fileContainer() const
|
const FileContainer &DocumentDoesNotExistException::fileContainer() const
|
||||||
{
|
{
|
||||||
return fileContainer_;
|
return fileContainer_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *TranslationUnitDoesNotExistException::what() const Q_DECL_NOEXCEPT
|
const char *DocumentDoesNotExistException::what() const Q_DECL_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (what_.isEmpty())
|
if (what_.isEmpty())
|
||||||
what_ += Utf8StringLiteral("Translation unit '")
|
what_ += Utf8StringLiteral("Translation unit '")
|
||||||
@@ -109,18 +109,18 @@ const char *TranslationUnitDoesNotExistException::what() const Q_DECL_NOEXCEPT
|
|||||||
return what_.constData();
|
return what_.constData();
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitFileNotExitsException::TranslationUnitFileNotExitsException(
|
DocumentFileDoesNotExistException::DocumentFileDoesNotExistException(
|
||||||
const Utf8String &filePath)
|
const Utf8String &filePath)
|
||||||
: filePath_(filePath)
|
: filePath_(filePath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Utf8String &TranslationUnitFileNotExitsException::filePath() const
|
const Utf8String &DocumentFileDoesNotExistException::filePath() const
|
||||||
{
|
{
|
||||||
return filePath_;
|
return filePath_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *TranslationUnitFileNotExitsException::what() const Q_DECL_NOEXCEPT
|
const char *DocumentFileDoesNotExistException::what() const Q_DECL_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (what_.isEmpty())
|
if (what_.isEmpty())
|
||||||
what_ += Utf8StringLiteral("File ")
|
what_ += Utf8StringLiteral("File ")
|
||||||
@@ -130,7 +130,7 @@ const char *TranslationUnitFileNotExitsException::what() const Q_DECL_NOEXCEPT
|
|||||||
return what_.constData();
|
return what_.constData();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *TranslationUnitIsNullException::what() const Q_DECL_NOEXCEPT
|
const char *DocumentIsNullException::what() const Q_DECL_NOEXCEPT
|
||||||
{
|
{
|
||||||
return "Tried to access a null TranslationUnit!";
|
return "Tried to access a null TranslationUnit!";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ private:
|
|||||||
mutable Utf8String what_;
|
mutable Utf8String what_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TranslationUnitAlreadyExistsException : public std::exception
|
class DocumentAlreadyExistsException : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TranslationUnitAlreadyExistsException(const FileContainer &fileContainer);
|
DocumentAlreadyExistsException(const FileContainer &fileContainer);
|
||||||
TranslationUnitAlreadyExistsException(const Utf8String &filePath,
|
DocumentAlreadyExistsException(const Utf8String &filePath,
|
||||||
const Utf8String &projectPartId);
|
const Utf8String &projectPartId);
|
||||||
|
|
||||||
const FileContainer &fileContainer() const;
|
const FileContainer &fileContainer() const;
|
||||||
|
|
||||||
@@ -65,12 +65,12 @@ private:
|
|||||||
mutable Utf8String what_;
|
mutable Utf8String what_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TranslationUnitDoesNotExistException : public std::exception
|
class DocumentDoesNotExistException : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TranslationUnitDoesNotExistException(const FileContainer &fileContainer);
|
DocumentDoesNotExistException(const FileContainer &fileContainer);
|
||||||
TranslationUnitDoesNotExistException(const Utf8String &filePath,
|
DocumentDoesNotExistException(const Utf8String &filePath,
|
||||||
const Utf8String &projectPartId);
|
const Utf8String &projectPartId);
|
||||||
|
|
||||||
const FileContainer &fileContainer() const;
|
const FileContainer &fileContainer() const;
|
||||||
|
|
||||||
@@ -81,10 +81,10 @@ private:
|
|||||||
mutable Utf8String what_;
|
mutable Utf8String what_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TranslationUnitFileNotExitsException : public std::exception
|
class DocumentFileDoesNotExistException : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TranslationUnitFileNotExitsException(const Utf8String &filePath);
|
DocumentFileDoesNotExistException(const Utf8String &filePath);
|
||||||
|
|
||||||
const Utf8String &filePath() const;
|
const Utf8String &filePath() const;
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ private:
|
|||||||
mutable Utf8String what_;
|
mutable Utf8String what_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TranslationUnitIsNullException : public std::exception
|
class DocumentIsNullException : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const char *what() const Q_DECL_NOEXCEPT override;
|
const char *what() const Q_DECL_NOEXCEPT override;
|
||||||
|
|||||||
@@ -52,13 +52,11 @@ bool JobContext::isOutdated() const
|
|||||||
|
|
||||||
bool JobContext::isDocumentOpen() const
|
bool JobContext::isDocumentOpen() const
|
||||||
{
|
{
|
||||||
const bool hasTranslationUnit
|
const bool hasDocument = documents->hasDocument(jobRequest.filePath, jobRequest.projectPartId);
|
||||||
= documents->hasDocument(jobRequest.filePath, jobRequest.projectPartId);
|
if (!hasDocument)
|
||||||
|
|
||||||
if (!hasTranslationUnit)
|
|
||||||
qCDebug(jobsLog) << "Document already closed for results of" << jobRequest;
|
qCDebug(jobsLog) << "Document already closed for results of" << jobRequest;
|
||||||
|
|
||||||
return hasTranslationUnit;
|
return hasDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JobContext::documentRevisionChanged() const
|
bool JobContext::documentRevisionChanged() const
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ protected:
|
|||||||
TEST_F(Documents, ThrowForGettingWithWrongFilePath)
|
TEST_F(Documents, ThrowForGettingWithWrongFilePath)
|
||||||
{
|
{
|
||||||
ASSERT_THROW(documents.document(nonExistingFilePath, projectPartId),
|
ASSERT_THROW(documents.document(nonExistingFilePath, projectPartId),
|
||||||
ClangBackEnd::TranslationUnitDoesNotExistException);
|
ClangBackEnd::DocumentDoesNotExistException);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ TEST_F(Documents, ThrowForAddingNonExistingFile)
|
|||||||
ClangBackEnd::FileContainer fileContainer(nonExistingFilePath, projectPartId);
|
ClangBackEnd::FileContainer fileContainer(nonExistingFilePath, projectPartId);
|
||||||
|
|
||||||
ASSERT_THROW(documents.create({fileContainer}),
|
ASSERT_THROW(documents.create({fileContainer}),
|
||||||
ClangBackEnd::TranslationUnitFileNotExitsException);
|
ClangBackEnd::DocumentFileDoesNotExistException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Documents, DoNotThrowForAddingNonExistingFileWithUnsavedContent)
|
TEST_F(Documents, DoNotThrowForAddingNonExistingFileWithUnsavedContent)
|
||||||
@@ -139,14 +139,14 @@ TEST_F(Documents, ThrowForCreatingAnExistingDocument)
|
|||||||
documents.create({fileContainer});
|
documents.create({fileContainer});
|
||||||
|
|
||||||
ASSERT_THROW(documents.create({fileContainer}),
|
ASSERT_THROW(documents.create({fileContainer}),
|
||||||
ClangBackEnd::TranslationUnitAlreadyExistsException);
|
ClangBackEnd::DocumentAlreadyExistsException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Documents, ThrowForUpdatingANonExistingDocument)
|
TEST_F(Documents, ThrowForUpdatingANonExistingDocument)
|
||||||
{
|
{
|
||||||
ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, Utf8StringVector(), 74u);
|
ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, Utf8StringVector(), 74u);
|
||||||
ASSERT_THROW(documents.update({fileContainer}),
|
ASSERT_THROW(documents.update({fileContainer}),
|
||||||
ClangBackEnd::TranslationUnitDoesNotExistException);
|
ClangBackEnd::DocumentDoesNotExistException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Documents, UpdateSingle)
|
TEST_F(Documents, UpdateSingle)
|
||||||
@@ -230,7 +230,7 @@ TEST_F(Documents, ThrowForRemovingWithWrongFilePath)
|
|||||||
ClangBackEnd::FileContainer fileContainer(nonExistingFilePath, projectPartId);
|
ClangBackEnd::FileContainer fileContainer(nonExistingFilePath, projectPartId);
|
||||||
|
|
||||||
ASSERT_THROW(documents.remove({fileContainer}),
|
ASSERT_THROW(documents.remove({fileContainer}),
|
||||||
ClangBackEnd::TranslationUnitDoesNotExistException);
|
ClangBackEnd::DocumentDoesNotExistException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Documents, ThrowForRemovingWithWrongProjectPartFilePath)
|
TEST_F(Documents, ThrowForRemovingWithWrongProjectPartFilePath)
|
||||||
@@ -249,7 +249,7 @@ TEST_F(Documents, Remove)
|
|||||||
documents.remove({fileContainer});
|
documents.remove({fileContainer});
|
||||||
|
|
||||||
ASSERT_THROW(documents.document(filePath, projectPartId),
|
ASSERT_THROW(documents.document(filePath, projectPartId),
|
||||||
ClangBackEnd::TranslationUnitDoesNotExistException);
|
ClangBackEnd::DocumentDoesNotExistException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Documents, RemoveAllValidIfExceptionIsThrown)
|
TEST_F(Documents, RemoveAllValidIfExceptionIsThrown)
|
||||||
@@ -258,7 +258,7 @@ TEST_F(Documents, RemoveAllValidIfExceptionIsThrown)
|
|||||||
documents.create({fileContainer});
|
documents.create({fileContainer});
|
||||||
|
|
||||||
ASSERT_THROW(documents.remove({ClangBackEnd::FileContainer(Utf8StringLiteral("dontextist.pro"), projectPartId), fileContainer}),
|
ASSERT_THROW(documents.remove({ClangBackEnd::FileContainer(Utf8StringLiteral("dontextist.pro"), projectPartId), fileContainer}),
|
||||||
ClangBackEnd::TranslationUnitDoesNotExistException);
|
ClangBackEnd::DocumentDoesNotExistException);
|
||||||
|
|
||||||
ASSERT_THAT(documents.documents(),
|
ASSERT_THAT(documents.documents(),
|
||||||
Not(Contains(Document(filePath,
|
Not(Contains(Document(filePath,
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ TEST_F(Document, DefaultDocumentIsNotIntact)
|
|||||||
TEST_F(Document, ThrowExceptionForNonExistingFilePath)
|
TEST_F(Document, ThrowExceptionForNonExistingFilePath)
|
||||||
{
|
{
|
||||||
ASSERT_THROW(::Document(Utf8StringLiteral("file.cpp"), projectPart, Utf8StringVector(), documents),
|
ASSERT_THROW(::Document(Utf8StringLiteral("file.cpp"), projectPart, Utf8StringVector(), documents),
|
||||||
ClangBackEnd::TranslationUnitFileNotExitsException);
|
ClangBackEnd::DocumentFileDoesNotExistException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Document, ThrowNoExceptionForNonExistingFilePathIfDoNotCheckIfFileExistsIsSet)
|
TEST_F(Document, ThrowNoExceptionForNonExistingFilePathIfDoNotCheckIfFileExistsIsSet)
|
||||||
@@ -122,14 +122,14 @@ TEST_F(Document, ThrowExceptionForGettingIndexForInvalidUnit)
|
|||||||
{
|
{
|
||||||
::Document document;
|
::Document document;
|
||||||
|
|
||||||
ASSERT_THROW(document.translationUnit().cxIndex(), ClangBackEnd::TranslationUnitIsNullException);
|
ASSERT_THROW(document.translationUnit().cxIndex(), ClangBackEnd::DocumentIsNullException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Document, ThrowExceptionForGettingCxTranslationUnitForInvalidUnit)
|
TEST_F(Document, ThrowExceptionForGettingCxTranslationUnitForInvalidUnit)
|
||||||
{
|
{
|
||||||
::Document document;
|
::Document document;
|
||||||
|
|
||||||
ASSERT_THROW(document.translationUnit().cxIndex(), ClangBackEnd::TranslationUnitIsNullException);
|
ASSERT_THROW(document.translationUnit().cxIndex(), ClangBackEnd::DocumentIsNullException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Document, CxTranslationUnitGetterIsNonNullForParsedUnit)
|
TEST_F(Document, CxTranslationUnitGetterIsNonNullForParsedUnit)
|
||||||
@@ -143,7 +143,7 @@ TEST_F(Document, ThrowExceptionIfGettingFilePathForNullUnit)
|
|||||||
{
|
{
|
||||||
::Document document;
|
::Document document;
|
||||||
|
|
||||||
ASSERT_THROW(document.filePath(), ClangBackEnd::TranslationUnitIsNullException);
|
ASSERT_THROW(document.filePath(), ClangBackEnd::DocumentIsNullException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Document, ResettedDocumentIsNull)
|
TEST_F(Document, ResettedDocumentIsNull)
|
||||||
|
|||||||
Reference in New Issue
Block a user