summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2017-10-17 12:48:07 +0200
committerNikolai Kosjar <nikolai.kosjar@qt.io>2017-10-19 07:43:21 +0000
commit7cbc7af0223d6a701a47bd63cd85cfc95686cee8 (patch)
treefa97d5ae63637fc0335761070ebe0a77167e611e /tests
parent2aed9f5c9727883a5fc54bf8cd7ec223be52c942 (diff)
downloadqt-creator-7cbc7af0223d6a701a47bd63cd85cfc95686cee8.tar.gz
Clang: Fix completion after qualification (::)
...and maybe other cases. Since Clang: fix findStartOfName handling commit 82d0650b116e0607e24021b0930e57759c53b449 the proposal's base position was calculated wrong. As a result, an early return triggert in CodeAssistantPrivate::displayProposal (call to newProposal->hasItemsToPropose(prefix, reason)) and no completions were displayed. Fix by ensuring that the added code from the mentioned commit is only called when needed, namely only for function expressions. Task-number: QTCREATORBUG-19083 Change-Id: I8f23c9b7186f9d81159939c8b3ef475a09bbe760 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/unittest/activationsequencecontextprocessor-test.cpp4
-rw-r--r--tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp7
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/unit/unittest/activationsequencecontextprocessor-test.cpp b/tests/unit/unittest/activationsequencecontextprocessor-test.cpp
index 5ccc7d500a..62a70d752c 100644
--- a/tests/unit/unittest/activationsequencecontextprocessor-test.cpp
+++ b/tests/unit/unittest/activationsequencecontextprocessor-test.cpp
@@ -147,7 +147,9 @@ TEST(ActivationSequenceContextProcessor, TemplateFunctionLeftParen)
TEST(ActivationSequenceContextProcessor, TemplateFunctionSecondParameter)
{
ClangCompletionAssistInterface interface("foo<X>(", 7);
- int startOfname = ContextProcessor::findStartOfName(&interface, 6);
+ int startOfname = ContextProcessor::findStartOfName(&interface,
+ 6,
+ ContextProcessor::NameCategory::Function);
ASSERT_THAT(startOfname, 0);
}
diff --git a/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp b/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp
index 09938b2c5d..9047b09165 100644
--- a/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp
+++ b/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp
@@ -178,6 +178,13 @@ TEST_F(ClangCompletionContextAnalyzer, AfterSpace)
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, 0, 0, positionInText));
}
+TEST_F(ClangCompletionContextAnalyzer, AfterQualification)
+{
+ auto analyzer = runAnalyzer(" Foo::@");
+
+ ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, 0, 0, positionInText));
+}
+
TEST_F(ClangCompletionContextAnalyzer, AtEndOfDotMember)
{
auto analyzer = runAnalyzer("o.mem@");