aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-06-01 10:46:20 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-06-04 08:48:33 +0000
commit4e4bd4909af55dbb716fae061244eae5577b4054 (patch)
tree13899e2b854fb0aaf829f8aace69bbaadf0f1a03 /tests
parent52bd5173fbf00428698368d4cf19bb2bf4b0332a (diff)
Clang: Use follow symbol result from clang when global fails
When built-in code model fails to follow symbol under cursor fall back to the clang result even if it only follows to the decalration. Change-Id: I22d8c5fee6ab7594b1d1b7ce8104414db28383c7 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/unittest/clangcodemodelserver-test.cpp8
-rw-r--r--tests/unit/unittest/clangfollowsymbol-test.cpp6
-rw-r--r--tests/unit/unittest/gtest-creator-printing.cpp12
-rw-r--r--tests/unit/unittest/gtest-creator-printing.h2
4 files changed, 20 insertions, 8 deletions
diff --git a/tests/unit/unittest/clangcodemodelserver-test.cpp b/tests/unit/unittest/clangcodemodelserver-test.cpp
index ebcb5dd3d3..7f88681f32 100644
--- a/tests/unit/unittest/clangcodemodelserver-test.cpp
+++ b/tests/unit/unittest/clangcodemodelserver-test.cpp
@@ -630,14 +630,12 @@ void ClangCodeModelServer::expectReferences()
void ClangCodeModelServer::expectFollowSymbol()
{
- const ClangBackEnd::SourceRangeContainer classDefinition{
- {filePathC, 40, 7},
- {filePathC, 40, 10}
- };
+ const ClangBackEnd::FollowSymbolResult classDefinition
+ = ClangBackEnd::SourceRangeContainer({filePathC, 40, 7}, {filePathC, 40, 10});
EXPECT_CALL(mockClangCodeModelClient,
followSymbol(
- Field(&FollowSymbolMessage::sourceRange,
+ Field(&FollowSymbolMessage::result,
Eq(classDefinition))))
.Times(1);
}
diff --git a/tests/unit/unittest/clangfollowsymbol-test.cpp b/tests/unit/unittest/clangfollowsymbol-test.cpp
index f42e8e6399..9df7349306 100644
--- a/tests/unit/unittest/clangfollowsymbol-test.cpp
+++ b/tests/unit/unittest/clangfollowsymbol-test.cpp
@@ -32,6 +32,7 @@
#include <clangdocuments.h>
#include <clangtranslationunit.h>
#include <fixitcontainer.h>
+#include <followsymbolmessage.h>
#include <projectpart.h>
#include <projects.h>
#include <sourcelocationcontainer.h>
@@ -55,6 +56,7 @@ using ::ClangBackEnd::Document;
using ::ClangBackEnd::UnsavedFiles;
using ::ClangBackEnd::ReferencesResult;
using ::ClangBackEnd::SourceRangeContainer;
+using ::ClangBackEnd::FollowSymbolResult;
namespace {
const Utf8String sourceFilePath = Utf8StringLiteral(TESTDATA_DIR"/followsymbol_main.cpp");
@@ -131,12 +133,12 @@ public:
class FollowSymbol : public ::testing::Test
{
protected:
- SourceRangeContainer followSymbol(uint line, uint column)
+ FollowSymbolResult followSymbol(uint line, uint column)
{
return document.translationUnit().followSymbol(line, column);
}
- SourceRangeContainer followHeaderSymbol(uint line, uint column)
+ FollowSymbolResult followHeaderSymbol(uint line, uint column)
{
return headerDocument.translationUnit().followSymbol(line, column);
}
diff --git a/tests/unit/unittest/gtest-creator-printing.cpp b/tests/unit/unittest/gtest-creator-printing.cpp
index c3e02240fe..3b1a761a80 100644
--- a/tests/unit/unittest/gtest-creator-printing.cpp
+++ b/tests/unit/unittest/gtest-creator-printing.cpp
@@ -237,12 +237,22 @@ std::ostream &operator<<(std::ostream &os, const RegisterProjectPartsForEditorMe
return os;
}
+std::ostream &operator<<(std::ostream &os, const FollowSymbolResult &result)
+{
+ os << "("
+ << result.range
+ << ", " << result.isPureDeclarationForUsage
+ << ")";
+
+ return os;
+}
+
std::ostream &operator<<(std::ostream &os, const FollowSymbolMessage &message)
{
os << "("
<< message.fileContainer << ", "
<< message.ticketNumber << ", "
- << message.sourceRange << ", "
+ << message.result << ", "
<< ")";
return os;
diff --git a/tests/unit/unittest/gtest-creator-printing.h b/tests/unit/unittest/gtest-creator-printing.h
index 6404764544..d809b18b6e 100644
--- a/tests/unit/unittest/gtest-creator-printing.h
+++ b/tests/unit/unittest/gtest-creator-printing.h
@@ -105,6 +105,7 @@ class EchoMessage;
class DocumentAnnotationsChangedMessage;
class ReferencesMessage;
class ToolTipMessage;
+class FollowSymbolResult;
class FollowSymbolMessage;
class CompleteCodeMessage;
class EndMessage;
@@ -177,6 +178,7 @@ std::ostream &operator<<(std::ostream &out, const EchoMessage &message);
std::ostream &operator<<(std::ostream &out, const DocumentAnnotationsChangedMessage &message);
std::ostream &operator<<(std::ostream &out, const ReferencesMessage &message);
std::ostream &operator<<(std::ostream &out, const ToolTipMessage &message);
+std::ostream &operator<<(std::ostream &out, const FollowSymbolResult &result);
std::ostream &operator<<(std::ostream &out, const FollowSymbolMessage &message);
std::ostream &operator<<(std::ostream &out, const CompleteCodeMessage &message);
std::ostream &operator<<(std::ostream &out, const EndMessage &message);