summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2013-02-19 08:44:44 +0100
committerErik Verbruggen <erik.verbruggen@digia.com>2013-02-21 16:32:25 +0100
commitea32191542ad0d2f9f02ad77ad38f94b5152e04e (patch)
treec826d51627f3e241abf732fe2ebbae786454b547 /src/plugins/cpptools/cppcompletion_test.cpp
parent195d39242d4b5159c03013542244b3fe4b0e1e43 (diff)
downloadqt-creator-ea32191542ad0d2f9f02ad77ad38f94b5152e04e.tar.gz
C++: fix instantiation of template special. with pointer argument
Fixed code completion for instantiation of template specialization with argument as pointer, e.g.: template <typename T> struct Template { T variable; }; template <typename T> struct Template<T *> { T *pointer; }; Template<int*> templ; templ.pointer; Change-Id: I7c79fe0cd7119b1208f064aece0cafdf50e1a012 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index fb61faec0d..34ea48fee2 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -1613,3 +1613,36 @@ void CppToolsPlugin::test_completion_resolve_complex_typedef_with_template()
QVERIFY(completions.contains(QLatin1String("bar")));
QVERIFY(completions.contains(QLatin1String("Template1")));
}
+
+void CppToolsPlugin::test_completion_template_specialization_with_pointer()
+{
+ TestData data;
+ data.srcText = "\n"
+ "template <typename T>\n"
+ "struct Template\n"
+ "{\n"
+ " T variable;\n"
+ "};\n"
+ "template <typename T>\n"
+ "struct Template<T *>\n"
+ "{\n"
+ " T *pointer;\n"
+ "};\n"
+ "Template<int*> templ;\n"
+ "@\n"
+ ;
+ setup(&data);
+
+ Utils::ChangeSet change;
+ QString txt = QLatin1String("templ.");
+ change.insert(data.pos, txt);
+ QTextCursor cursor(data.doc);
+ change.apply(&cursor);
+ data.pos += txt.length();
+
+ QStringList completions = getCompletions(data);
+
+ QCOMPARE(completions.size(), 2);
+ QVERIFY(completions.contains(QLatin1String("Template")));
+ QVERIFY(completions.contains(QLatin1String("pointer")));
+}