summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchcreator.cpp34
-rw-r--r--src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp8
-rw-r--r--src/tools/clangrefactoringbackend/source/clangtool.cpp4
-rw-r--r--src/tools/clangrefactoringbackend/source/refactoringserver.cpp20
-rw-r--r--src/tools/clangrefactoringbackend/source/sourcerangeextractor.cpp2
-rw-r--r--tests/unit/unittest/clangquery-test.cpp18
-rw-r--r--tests/unit/unittest/clangquerygatherer-test.cpp102
-rw-r--r--tests/unit/unittest/clangqueryprojectfindfilter-test.cpp8
-rw-r--r--tests/unit/unittest/dynamicastmatcherdiagnosticcontainer-matcher.h28
-rw-r--r--tests/unit/unittest/pchcreator-test.cpp2
-rw-r--r--tests/unit/unittest/refactoringclient-test.cpp6
-rw-r--r--tests/unit/unittest/refactoringserver-test.cpp73
-rw-r--r--tests/unit/unittest/sourcerangecontainer-matcher.h18
-rw-r--r--tests/unit/unittest/symbolfinder-test.cpp6
14 files changed, 163 insertions, 166 deletions
diff --git a/src/tools/clangpchmanagerbackend/source/pchcreator.cpp b/src/tools/clangpchmanagerbackend/source/pchcreator.cpp
index a73ee3ceec..5b77fc21b3 100644
--- a/src/tools/clangpchmanagerbackend/source/pchcreator.cpp
+++ b/src/tools/clangpchmanagerbackend/source/pchcreator.cpp
@@ -146,7 +146,7 @@ Utils::PathStringVector generatedFilePaths(const V2::FileContainers &generaredFi
generaredFilePaths.reserve(generaredFiles.size());
for (const V2::FileContainer &generatedFile : generaredFiles)
- generaredFilePaths.push_back(generatedFile.filePath().path());
+ generaredFilePaths.push_back(generatedFile.filePath.path());
return generaredFilePaths;
}
@@ -156,7 +156,7 @@ Utils::PathStringVector generatedFilePaths(const V2::FileContainers &generaredFi
Utils::PathStringVector PchCreator::generateGlobalHeaderPaths() const
{
auto includeFunction = [&] (const V2::ProjectPartContainer &projectPart) {
- return m_filePathCache.filePaths(projectPart.headerPathIds());
+ return m_filePathCache.filePaths(projectPart.headerPathIds);
};
Utils::PathStringVector headerPaths = generateGlobal<Utils::PathStringVector>(m_projectParts,
@@ -175,7 +175,7 @@ Utils::PathStringVector PchCreator::generateGlobalHeaderPaths() const
Utils::PathStringVector PchCreator::generateGlobalSourcePaths() const
{
auto sourceFunction = [&] (const V2::ProjectPartContainer &projectPart) {
- return m_filePathCache.filePaths(projectPart.sourcePathIds());
+ return m_filePathCache.filePaths(projectPart.sourcePathIds);
};
return generateGlobal<Utils::PathStringVector>(m_projectParts, sourceFunction);
@@ -197,7 +197,7 @@ Utils::SmallStringVector PchCreator::generateGlobalArguments() const
auto argumentFunction = [] (const V2::ProjectPartContainer &projectPart)
-> const Utils::SmallStringVector & {
- return projectPart.arguments();
+ return projectPart.arguments;
};
generateGlobal(arguments, m_projectParts, argumentFunction);
@@ -212,7 +212,7 @@ Utils::SmallStringVector PchCreator::generateGlobalCommandLine() const
auto argumentFunction = [] (const V2::ProjectPartContainer &projectPart)
-> const Utils::SmallStringVector & {
- return projectPart.arguments();
+ return projectPart.arguments;
};
generateGlobal(commandLine, m_projectParts, argumentFunction);
@@ -324,10 +324,10 @@ namespace {
void hashProjectPart(QCryptographicHash &hash, const V2::ProjectPartContainer &projectPart)
{
- const auto &projectPartId = projectPart.projectPartId();
+ const auto &projectPartId = projectPart.projectPartId;
hash.addData(projectPartId.data(), projectPartId.size());
- for (const auto &argument : projectPart.arguments())
+ for (const auto &argument : projectPart.arguments)
hash.addData(argument.data(), argument.size());
}
}
@@ -374,7 +374,7 @@ Utils::SmallString PchCreator::generateGlobalPchFilePath() const
Utils::SmallStringVector PchCreator::generateProjectPartCommandLine(
const V2::ProjectPartContainer &projectPart) const
{
- const Utils::SmallStringVector &arguments = projectPart.arguments();
+ const Utils::SmallStringVector &arguments = projectPart.arguments;
Utils::SmallStringVector commandLine;
commandLine.reserve(arguments.size() + 1);
@@ -400,10 +400,10 @@ Utils::PathStringVector PchCreator::generateProjectPartHeaders(
const V2::ProjectPartContainer &projectPart) const
{
Utils::PathStringVector headerPaths;
- headerPaths.reserve(projectPart.headerPathIds().size() + m_generatedFiles.size());
+ headerPaths.reserve(projectPart.headerPathIds.size() + m_generatedFiles.size());
- std::transform(projectPart.headerPathIds().begin(),
- projectPart.headerPathIds().end(),
+ std::transform(projectPart.headerPathIds.begin(),
+ projectPart.headerPathIds.end(),
std::back_inserter(headerPaths),
[&] (FilePathId filePathId) {
return m_filePathCache.filePath(filePathId);
@@ -459,10 +459,10 @@ Utils::PathStringVector PchCreator::generateProjectPartHeaderAndSourcePaths(
const V2::ProjectPartContainer &projectPart) const
{
Utils::PathStringVector includeAndSources;
- includeAndSources.reserve(projectPart.headerPathIds().size() + projectPart.sourcePathIds().size());
+ includeAndSources.reserve(projectPart.headerPathIds.size() + projectPart.sourcePathIds.size());
- appendFilePathId(includeAndSources, projectPart.headerPathIds(), m_filePathCache);
- appendFilePathId(includeAndSources, projectPart.sourcePathIds(), m_filePathCache);
+ appendFilePathId(includeAndSources, projectPart.headerPathIds, m_filePathCache);
+ appendFilePathId(includeAndSources, projectPart.sourcePathIds, m_filePathCache);
return includeAndSources;
}
@@ -536,7 +536,7 @@ Utils::SmallStringVector PchCreator::generateProjectPartPchCompilerArguments(
Utils::SmallStringVector PchCreator::generateProjectPartClangCompilerArguments(
const V2::ProjectPartContainer &projectPart) const
{
- Utils::SmallStringVector compilerArguments = projectPart.arguments().clone();
+ Utils::SmallStringVector compilerArguments = projectPart.arguments.clone();
const auto pchArguments = generateProjectPartPchCompilerArguments(projectPart);
append(compilerArguments, pchArguments);
@@ -556,9 +556,9 @@ IdPaths PchCreator::generateProjectPartPch(const V2::ProjectPartContainer &proje
generateFileWithContent(pchIncludeFilePath, content);
generatePch(generateProjectPartClangCompilerArguments(projectPart),
- {projectPart.projectPartId().clone(), std::move(pchFilePath), lastModified});
+ {projectPart.projectPartId.clone(), std::move(pchFilePath), lastModified});
- return {projectPart.projectPartId().clone(), std::move(allExternalIncludes)};
+ return {projectPart.projectPartId.clone(), std::move(allExternalIncludes)};
}
void PchCreator::generatePchs()
diff --git a/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp b/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp
index 0ac42d6ef1..21cd0d26e5 100644
--- a/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp
+++ b/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp
@@ -50,10 +50,10 @@ ClangQueryGatherer::createSourceRangesForSource(
{
ClangQuery clangQuery(*filePathCache, std::move(query));
- clangQuery.addFile(std::string(source.filePath().directory()),
- std::string(source.filePath().name()),
- std::string(source.takeUnsavedFileContent()),
- std::vector<std::string>(source.takeCommandLineArguments()));
+ clangQuery.addFile(std::string(source.filePath.directory()),
+ std::string(source.filePath.name()),
+ std::string(source.unsavedFileContent),
+ std::vector<std::string>(source.commandLineArguments));
clangQuery.addUnsavedFiles(unsaved);
diff --git a/src/tools/clangrefactoringbackend/source/clangtool.cpp b/src/tools/clangrefactoringbackend/source/clangtool.cpp
index d7d740bd1a..18f4e4cdcf 100644
--- a/src/tools/clangrefactoringbackend/source/clangtool.cpp
+++ b/src/tools/clangrefactoringbackend/source/clangtool.cpp
@@ -102,8 +102,8 @@ void ClangTool::addUnsavedFiles(const V2::FileContainers &unsavedFiles)
m_unsavedFileContents.reserve(m_unsavedFileContents.size() + unsavedFiles.size());
auto convertToUnsavedFileContent = [] (const V2::FileContainer &unsavedFile) {
- return UnsavedFileContent{toNativePath(unsavedFile.filePath().path().clone()),
- unsavedFile.unsavedFileContent().clone()};
+ return UnsavedFileContent{toNativePath(unsavedFile.filePath.path().clone()),
+ unsavedFile.unsavedFileContent.clone()};
};
std::transform(unsavedFiles.begin(),
diff --git a/src/tools/clangrefactoringbackend/source/refactoringserver.cpp b/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
index d45098f399..68aa24cbcd 100644
--- a/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
+++ b/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
@@ -58,18 +58,18 @@ void RefactoringServer::end()
void RefactoringServer::requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message)
{
- SymbolFinder symbolFinder(message.line(), message.column(), m_filePathCache);
+ SymbolFinder symbolFinder(message.line, message.column, m_filePathCache);
- symbolFinder.addFile(std::string(message.filePath().directory()),
- std::string(message.filePath().name()),
- std::string(message.unsavedContent()),
- std::vector<std::string>(message.commandLine()));
+ symbolFinder.addFile(std::string(message.filePath.directory()),
+ std::string(message.filePath.name()),
+ std::string(message.unsavedContent),
+ std::vector<std::string>(message.commandLine));
symbolFinder.findSymbol();
client()->sourceLocationsForRenamingMessage({symbolFinder.takeSymbolName(),
symbolFinder.takeSourceLocations(),
- message.textDocumentRevision()});
+ message.textDocumentRevision});
}
void RefactoringServer::requestSourceRangesAndDiagnosticsForQueryMessage(
@@ -77,10 +77,10 @@ void RefactoringServer::requestSourceRangesAndDiagnosticsForQueryMessage(
{
ClangQuery clangQuery(m_filePathCache, message.takeQuery());
- clangQuery.addFile(std::string(message.source().filePath().directory()),
- std::string(message.source().filePath().name()),
- std::string(message.source().unsavedFileContent()),
- std::vector<std::string>(message.source().commandLineArguments()));
+ clangQuery.addFile(std::string(message.source.filePath.directory()),
+ std::string(message.source.filePath.name()),
+ std::string(message.source.unsavedFileContent),
+ std::vector<std::string>(message.source.commandLineArguments));
clangQuery.findLocations();
diff --git a/src/tools/clangrefactoringbackend/source/sourcerangeextractor.cpp b/src/tools/clangrefactoringbackend/source/sourcerangeextractor.cpp
index 15dde240a4..66f2e23fc7 100644
--- a/src/tools/clangrefactoringbackend/source/sourcerangeextractor.cpp
+++ b/src/tools/clangrefactoringbackend/source/sourcerangeextractor.cpp
@@ -179,7 +179,7 @@ void SourceRangeExtractor::addSourceRanges(const std::vector<clang::SourceRange>
const std::vector<SourceRangeWithTextContainer> &SourceRangeExtractor::sourceRangeWithTextContainers() const
{
- return sourceRangesContainer.sourceRangeWithTextContainers();
+ return sourceRangesContainer.sourceRangeWithTextContainers;
}
} // namespace ClangBackEnd
diff --git a/tests/unit/unittest/clangquery-test.cpp b/tests/unit/unittest/clangquery-test.cpp
index ec1984084f..8c486a47d7 100644
--- a/tests/unit/unittest/clangquery-test.cpp
+++ b/tests/unit/unittest/clangquery-test.cpp
@@ -69,7 +69,7 @@ TEST_F(ClangQuery, NoSourceRangesForDefaultConstruction)
{
auto sourceRanges = simpleFunctionQuery.takeSourceRanges();
- ASSERT_THAT(sourceRanges.sourceRangeWithTextContainers(), IsEmpty());
+ ASSERT_THAT(sourceRanges.sourceRangeWithTextContainers, IsEmpty());
}
TEST_F(ClangQuerySlowTest, SourceRangesForSimpleFunctionDeclarationAreNotEmpty)
@@ -78,7 +78,7 @@ TEST_F(ClangQuerySlowTest, SourceRangesForSimpleFunctionDeclarationAreNotEmpty)
simpleFunctionQuery.findLocations();
- ASSERT_THAT(simpleFunctionQuery.takeSourceRanges().sourceRangeWithTextContainers(), Not(IsEmpty()));
+ ASSERT_THAT(simpleFunctionQuery.takeSourceRanges().sourceRangeWithTextContainers, Not(IsEmpty()));
}
TEST_F(ClangQuerySlowTest, RootSourceRangeForSimpleFunctionDeclarationRange)
@@ -87,7 +87,7 @@ TEST_F(ClangQuerySlowTest, RootSourceRangeForSimpleFunctionDeclarationRange)
simpleFunctionQuery.findLocations();
- ASSERT_THAT(simpleFunctionQuery.takeSourceRanges().sourceRangeWithTextContainers(),
+ ASSERT_THAT(simpleFunctionQuery.takeSourceRanges().sourceRangeWithTextContainers,
Contains(IsSourceRangeWithText(1, 1, 8, 2, "int function(int* pointer, int value)\n{\n if (pointer == nullptr) {\n return value + 1;\n } else {\n return value - 1;\n }\n}")));
}
@@ -101,7 +101,7 @@ TEST_F(ClangQuerySlowTest, SourceRangeInUnsavedFileDeclarationRange)
query.findLocations();
- ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers(),
+ ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers,
Contains(IsSourceRangeWithText(1, 1, 1, 15, "void unsaved();")));
}
@@ -113,7 +113,7 @@ TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
query.findLocations();
- ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers(),
+ ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers,
Contains(IsSourceRangeWithText(1, 1, 1, 12, "void f() {}")));
}
@@ -127,7 +127,7 @@ TEST_F(ClangQuerySlowTest, DISABLED_SourceRangeInUnsavedFileDeclarationRangeOver
query.findLocations();
- ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers(),
+ ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers,
Contains(IsSourceRangeWithText(1, 1, 1, 15, "void unsaved();")));
}
@@ -137,7 +137,7 @@ TEST_F(ClangQuerySlowTest, RootSourceRangeForSimpleFieldDeclarationRange)
simpleClassQuery.findLocations();
- ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers().at(0),
+ ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers.at(0),
IsSourceRangeWithText(4, 5, 4, 10, " int x;"));
}
@@ -145,7 +145,7 @@ TEST_F(ClangQuerySlowTest, NoSourceRangesForEmptyQuery)
{
simpleClassQuery.findLocations();
- ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers(), IsEmpty());
+ ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers, IsEmpty());
}
TEST_F(ClangQuerySlowTest, NoSourceRangesForWrongQuery)
@@ -154,7 +154,7 @@ TEST_F(ClangQuerySlowTest, NoSourceRangesForWrongQuery)
simpleClassQuery.findLocations();
- ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers(), IsEmpty());
+ ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers, IsEmpty());
}
TEST_F(ClangQuerySlowTest, NoDiagnosticsForDefaultConstruction)
diff --git a/tests/unit/unittest/clangquerygatherer-test.cpp b/tests/unit/unittest/clangquerygatherer-test.cpp
index 59503bc61f..9c575f6a0f 100644
--- a/tests/unit/unittest/clangquerygatherer-test.cpp
+++ b/tests/unit/unittest/clangquerygatherer-test.cpp
@@ -48,13 +48,13 @@ using testing::Contains;
using testing::Each;
using testing::ElementsAre;
using testing::Eq;
+using testing::Field;
using testing::Ge;
using testing::IsEmpty;
using testing::Le;
using testing::NiceMock;
using testing::Pair;
using testing::PrintToString;
-using testing::Property;
using testing::SizeIs;
using testing::UnorderedElementsAre;
using testing::_;
@@ -71,8 +71,8 @@ MATCHER_P2(Contains, line, column,
+ ")"
)
{
- return arg.line() == uint(line)
- && arg.column() == uint(column);
+ return arg.line == uint(line)
+ && arg.column == uint(column);
}
class ClangQueryGatherer : public ::testing::Test
@@ -111,9 +111,9 @@ TEST_F(ClangQueryGatherer, CreateSourceRanges)
auto sourceRangesAndDiagnostics = gatherer.createSourceRangesForSource(&filePathCache, source.clone(), {unsaved}, query.clone());
ASSERT_THAT(sourceRangesAndDiagnostics,
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))));
}
TEST_F(ClangQueryGatherer, CreateSourceRangessWithUnsavedContent)
@@ -121,9 +121,9 @@ TEST_F(ClangQueryGatherer, CreateSourceRangessWithUnsavedContent)
auto sourceRangesAndDiagnostics = gatherer.createSourceRangesForSource(&filePathCache, source.clone(), {unsaved}, query.clone());
ASSERT_THAT(sourceRangesAndDiagnostics,
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
}
TEST_F(ClangQueryGatherer, CanCreateSourceRangesIfItHasSources)
@@ -143,9 +143,9 @@ TEST_F(ClangQueryGatherer, CreateSourceRangesForNextSource)
auto sourceRangesAndDiagnostics = gatherer.createNextSourceRanges();
ASSERT_THAT(sourceRangesAndDiagnostics,
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
}
TEST_F(ClangQueryGatherer, CreateSourceRangesForNextSourcePopsSource)
@@ -161,9 +161,9 @@ TEST_F(ClangQueryGatherer, StartCreateSourceRangesForNextSource)
future.wait();
ASSERT_THAT(future.get(),
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
}
TEST_F(ClangQueryGatherer, StartCreateSourceRangesForNextSourcePopsSource)
@@ -195,15 +195,15 @@ TEST_F(ClangQueryGatherer, AfterStartCreateSourceRangesMessagesGetCollected)
ASSERT_THAT(manyGatherer.allCurrentProcessedMessages(),
UnorderedElementsAre(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- UnorderedElementsAre(IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ UnorderedElementsAre(IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))),
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- UnorderedElementsAre(
- IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
- IsSourceRangeWithText(3, 1, 3, 15, "int function();"))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ UnorderedElementsAre(
+ IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
+ IsSourceRangeWithText(3, 1, 3, 15, "int function();"))))));
}
TEST_F(ClangQueryGatherer, GetFinishedMessages)
@@ -216,16 +216,16 @@ TEST_F(ClangQueryGatherer, GetFinishedMessages)
ASSERT_THAT(messages,
AllOf(SizeIs(2),
UnorderedElementsAre(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- UnorderedElementsAre(
- IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
- IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))),
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- UnorderedElementsAre(
- IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
- IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ UnorderedElementsAre(
+ IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
+ IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))),
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ UnorderedElementsAre(
+ IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
+ IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
}
TEST_F(ClangQueryGatherer, GetFinishedMessagesAfterSecondPass)
@@ -241,10 +241,10 @@ TEST_F(ClangQueryGatherer, GetFinishedMessagesAfterSecondPass)
ASSERT_THAT(messages,
AllOf(SizeIs(1),
ElementsAre(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- UnorderedElementsAre(
- IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ UnorderedElementsAre(
+ IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
}
TEST_F(ClangQueryGatherer, FilterDuplicates)
@@ -258,20 +258,20 @@ TEST_F(ClangQueryGatherer, FilterDuplicates)
ASSERT_THAT(messages,
AllOf(SizeIs(3),
UnorderedElementsAre(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- UnorderedElementsAre(
- IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
- IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))),
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- UnorderedElementsAre(
- IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
- IsSourceRangeWithText(3, 1, 3, 15, "int function();")))),
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- UnorderedElementsAre(
- IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ UnorderedElementsAre(
+ IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
+ IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))),
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ UnorderedElementsAre(
+ IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
+ IsSourceRangeWithText(3, 1, 3, 15, "int function();")))),
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ UnorderedElementsAre(
+ IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
}
TEST_F(ClangQueryGatherer, AfterGetFinishedMessagesFuturesAreReduced)
diff --git a/tests/unit/unittest/clangqueryprojectfindfilter-test.cpp b/tests/unit/unittest/clangqueryprojectfindfilter-test.cpp
index 33268cd002..1272a63da6 100644
--- a/tests/unit/unittest/clangqueryprojectfindfilter-test.cpp
+++ b/tests/unit/unittest/clangqueryprojectfindfilter-test.cpp
@@ -41,9 +41,9 @@ namespace {
using testing::_;
using testing::AllOf;
+using testing::Field;
using testing::NiceMock;
using testing::NotNull;
-using testing::Property;
using testing::Return;
using testing::ReturnNew;
using testing::DefaultValue;
@@ -166,9 +166,9 @@ TEST_F(ClangQueryProjectFindFilter, CallingRequestSourceRangesAndDiagnostics)
EXPECT_CALL(mockRefactoringServer,
requestSourceRangesAndDiagnosticsForQueryMessage(
AllOf(
- Property(&Message::source,
- Property(&FileContainer::unsavedFileContent, exampleContent)),
- Property(&Message::query, queryText))));
+ Field(&Message::source,
+ Field(&FileContainer::unsavedFileContent, exampleContent)),
+ Field(&Message::query, queryText))));
findFilter.requestSourceRangesAndDiagnostics(QString(queryText), QString(exampleContent));
}
diff --git a/tests/unit/unittest/dynamicastmatcherdiagnosticcontainer-matcher.h b/tests/unit/unittest/dynamicastmatcherdiagnosticcontainer-matcher.h
index 9a58f3b59f..1df67d04bd 100644
--- a/tests/unit/unittest/dynamicastmatcherdiagnosticcontainer-matcher.h
+++ b/tests/unit/unittest/dynamicastmatcherdiagnosticcontainer-matcher.h
@@ -41,19 +41,19 @@ MATCHER_P5(HasDiagnosticMessage, errorTypeText, startLine, startColumn, endLine,
+ ")}"
)
{
- if (!arg.empty() && arg.front().messages().empty()) {
+ if (!arg.empty() && arg.front().messages.empty()) {
*result_listener << "no messages";
return false;
}
- auto message = arg.front().messages().front();
- auto sourceRange = message.sourceRange();
+ auto message = arg.front().messages.front();
+ auto sourceRange = message.sourceRange;
return message.errorTypeText() == errorTypeText
- && sourceRange.start().line() == uint(startLine)
- && sourceRange.start().column() == uint(startColumn)
- && sourceRange.end().line() == uint(endLine)
- && sourceRange.end().column() == uint(endColumn);
+ && sourceRange.start.line == uint(startLine)
+ && sourceRange.start.column == uint(startColumn)
+ && sourceRange.end.line == uint(endLine)
+ && sourceRange.end.column == uint(endColumn);
}
MATCHER_P5(HasDiagnosticContext, contextTypeText, startLine, startColumn, endLine, endColumn,
@@ -66,19 +66,19 @@ MATCHER_P5(HasDiagnosticContext, contextTypeText, startLine, startColumn, endLin
+ ")}"
)
{
- if (!arg.empty() && arg.front().messages().empty()) {
+ if (!arg.empty() && arg.front().messages.empty()) {
*result_listener << "no context";
return false;
}
- auto context = arg.front().contexts().front();
- auto sourceRange = context.sourceRange();
+ auto context = arg.front().contexts.front();
+ auto sourceRange = context.sourceRange;
return context.contextTypeText() == contextTypeText
- && sourceRange.start().line() == uint(startLine)
- && sourceRange.start().column() == uint(startColumn)
- && sourceRange.end().line() == uint(endLine)
- && sourceRange.end().column() == uint(endColumn);
+ && sourceRange.start.line == uint(startLine)
+ && sourceRange.start.column == uint(startColumn)
+ && sourceRange.end.line == uint(endLine)
+ && sourceRange.end.column == uint(endColumn);
}
}
diff --git a/tests/unit/unittest/pchcreator-test.cpp b/tests/unit/unittest/pchcreator-test.cpp
index a2b2cf8498..f5990593f2 100644
--- a/tests/unit/unittest/pchcreator-test.cpp
+++ b/tests/unit/unittest/pchcreator-test.cpp
@@ -302,7 +302,7 @@ TEST_F(PchCreatorVerySlowTest, DISABLED_CreatePartPchs)
auto includePaths = creator.generateProjectPartPch(projectPart1);
- ASSERT_THAT(includePaths.id, projectPart1.projectPartId());
+ ASSERT_THAT(includePaths.id, projectPart1.projectPartId);
ASSERT_THAT(includePaths.filePathIds,
AllOf(Contains(FilePathId{1, 1}),
Contains(FilePathId{1, 2}),
diff --git a/tests/unit/unittest/refactoringclient-test.cpp b/tests/unit/unittest/refactoringclient-test.cpp
index 936b51a94e..36ce039221 100644
--- a/tests/unit/unittest/refactoringclient-test.cpp
+++ b/tests/unit/unittest/refactoringclient-test.cpp
@@ -96,9 +96,9 @@ TEST_F(RefactoringClient, SourceLocationsForRenaming)
{
client.setLocalRenamingCallback(mockLocalRenaming.AsStdFunction());
- EXPECT_CALL(mockLocalRenaming, Call(renameMessage.symbolName().toQString(),
- renameMessage.sourceLocations(),
- renameMessage.textDocumentRevision()));
+ EXPECT_CALL(mockLocalRenaming, Call(renameMessage.symbolName.toQString(),
+ renameMessage.sourceLocations,
+ renameMessage.textDocumentRevision));
client.sourceLocationsForRenamingMessage(std::move(renameMessage));
}
diff --git a/tests/unit/unittest/refactoringserver-test.cpp b/tests/unit/unittest/refactoringserver-test.cpp
index f4161c6cb8..0abe22f1b6 100644
--- a/tests/unit/unittest/refactoringserver-test.cpp
+++ b/tests/unit/unittest/refactoringserver-test.cpp
@@ -43,6 +43,7 @@ namespace {
using testing::AllOf;
using testing::Contains;
+using testing::Field;
using testing::IsEmpty;
using testing::NiceMock;
using testing::Not;
@@ -72,8 +73,8 @@ MATCHER_P2(IsSourceLocation, line, column,
+ ")"
)
{
- return arg.line() == uint(line)
- && arg.column() == uint(column);
+ return arg.line == uint(line)
+ && arg.column == uint(column);
}
class RefactoringServer : public ::testing::Test
@@ -116,12 +117,12 @@ TEST_F(RefactoringServerSlowTest, RequestSourceLocationsForRenamingMessage)
EXPECT_CALL(mockRefactoringClient,
sourceLocationsForRenamingMessage(
- AllOf(Property(&SourceLocationsForRenamingMessage::textDocumentRevision, 1),
- Property(&SourceLocationsForRenamingMessage::symbolName, "v"),
- Property(&SourceLocationsForRenamingMessage::sourceLocations,
- Property(&SourceLocationsContainer::sourceLocationContainers,
- AllOf(Contains(IsSourceLocation(1, 5)),
- Contains(IsSourceLocation(3, 9))))))));
+ AllOf(Field(&SourceLocationsForRenamingMessage::textDocumentRevision, 1),
+ Field(&SourceLocationsForRenamingMessage::symbolName, "v"),
+ Field(&SourceLocationsForRenamingMessage::sourceLocations,
+ Property(&SourceLocationsContainer::sourceLocationContainers,
+ AllOf(Contains(IsSourceLocation(1, 5)),
+ Contains(IsSourceLocation(3, 9))))))));
refactoringServer.requestSourceLocationsForRenamingMessage(std::move(message));
}
@@ -134,9 +135,9 @@ TEST_F(RefactoringServerSlowTest, RequestSingleSourceRangesForQueryMessage)
EXPECT_CALL(mockRefactoringClient,
sourceRangesForQueryMessage(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
refactoringServer.requestSourceRangesForQueryMessage(std::move(message));
}
@@ -156,9 +157,9 @@ TEST_F(RefactoringServerSlowTest, RequestSingleSourceRangesAndDiagnosticsWithUns
EXPECT_CALL(mockRefactoringClient,
sourceRangesForQueryMessage(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(1, 1, 1, 9, unsavedContent))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(1, 1, 1, 9, unsavedContent))))));
refactoringServer.requestSourceRangesForQueryMessage(std::move(message));
}
@@ -171,14 +172,14 @@ TEST_F(RefactoringServerSlowTest, RequestTwoSourceRangesForQueryMessage)
EXPECT_CALL(mockRefactoringClient,
sourceRangesForQueryMessage(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
EXPECT_CALL(mockRefactoringClient,
sourceRangesForQueryMessage(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Not(Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent)))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Not(Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent)))))));
refactoringServer.requestSourceRangesForQueryMessage(std::move(message));
}
@@ -195,14 +196,14 @@ TEST_F(RefactoringServerVerySlowTest, RequestManySourceRangesForQueryMessage)
EXPECT_CALL(mockRefactoringClient,
sourceRangesForQueryMessage(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
EXPECT_CALL(mockRefactoringClient,
sourceRangesForQueryMessage(
- Property(&SourceRangesForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Not(Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent)))))))
+ Field(&SourceRangesForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Not(Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent)))))))
.Times(processingSlotCount + 2);
refactoringServer.requestSourceRangesForQueryMessage(std::move(message));
@@ -269,11 +270,11 @@ TEST_F(RefactoringServerSlowTest, ForValidRequestSourceRangesAndDiagnosticsGetSo
EXPECT_CALL(mockRefactoringClient,
sourceRangesAndDiagnosticsForQueryMessage(
AllOf(
- Property(&SourceRangesAndDiagnosticsForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- Contains(IsSourceRangeWithText(1, 1, 1, 12, "void f() {}")))),
- Property(&SourceRangesAndDiagnosticsForQueryMessage::diagnostics,
- IsEmpty()))));
+ Field(&SourceRangesAndDiagnosticsForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ Contains(IsSourceRangeWithText(1, 1, 1, 12, "void f() {}")))),
+ Field(&SourceRangesAndDiagnosticsForQueryMessage::diagnostics,
+ IsEmpty()))));
refactoringServer.requestSourceRangesAndDiagnosticsForQueryMessage(std::move(message));
}
@@ -288,11 +289,11 @@ TEST_F(RefactoringServerSlowTest, ForInvalidRequestSourceRangesAndDiagnosticsGet
EXPECT_CALL(mockRefactoringClient,
sourceRangesAndDiagnosticsForQueryMessage(
AllOf(
- Property(&SourceRangesAndDiagnosticsForQueryMessage::sourceRanges,
- Property(&SourceRangesContainer::sourceRangeWithTextContainers,
- IsEmpty())),
- Property(&SourceRangesAndDiagnosticsForQueryMessage::diagnostics,
- Not(IsEmpty())))));
+ Field(&SourceRangesAndDiagnosticsForQueryMessage::sourceRanges,
+ Field(&SourceRangesContainer::sourceRangeWithTextContainers,
+ IsEmpty())),
+ Field(&SourceRangesAndDiagnosticsForQueryMessage::diagnostics,
+ Not(IsEmpty())))));
refactoringServer.requestSourceRangesAndDiagnosticsForQueryMessage(std::move(message));
}
diff --git a/tests/unit/unittest/sourcerangecontainer-matcher.h b/tests/unit/unittest/sourcerangecontainer-matcher.h
index 3656b840d7..c2345be533 100644
--- a/tests/unit/unittest/sourcerangecontainer-matcher.h
+++ b/tests/unit/unittest/sourcerangecontainer-matcher.h
@@ -40,10 +40,10 @@ MATCHER_P4(IsSourceRange, startLine, startColumn, endLine, endColumn,
+ ")]"
)
{
- return arg.start().line() == uint(startLine)
- && arg.start().column() == uint(startColumn)
- && arg.end().line() == uint(endLine)
- && arg.end().column() == uint(endColumn);
+ return arg.start.line == uint(startLine)
+ && arg.start.column == uint(startColumn)
+ && arg.end.line == uint(endLine)
+ && arg.end.column == uint(endColumn);
}
MATCHER_P5(IsSourceRangeWithText, startLine, startColumn, endLine, endColumn, text,
@@ -56,11 +56,11 @@ MATCHER_P5(IsSourceRangeWithText, startLine, startColumn, endLine, endColumn, te
+ ")"
)
{
- return arg.start().line() == uint(startLine)
- && arg.start().column() == uint(startColumn)
- && arg.end().line() == uint(endLine)
- && arg.end().column() == uint(endColumn)
- && arg.text().toCarriageReturnsStripped() == text;
+ return arg.start.line == uint(startLine)
+ && arg.start.column == uint(startColumn)
+ && arg.end.line == uint(endLine)
+ && arg.end.column == uint(endColumn)
+ && arg.text.toCarriageReturnsStripped() == text;
}
diff --git a/tests/unit/unittest/symbolfinder-test.cpp b/tests/unit/unittest/symbolfinder-test.cpp
index d036b5b227..6ab0bd06cd 100644
--- a/tests/unit/unittest/symbolfinder-test.cpp
+++ b/tests/unit/unittest/symbolfinder-test.cpp
@@ -42,11 +42,7 @@ MATCHER_P2(IsSourceLocation, line, column,
+ ", column " + PrintToString(column)
)
{
- if (arg.line() != uint(line)
- || arg.column() != uint(column))
- return false;
-
- return true;
+ return arg.line == uint(line) && arg.column == uint(column);
}
MATCHER_P(StrEq, text,