summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2014-07-11 07:56:15 +0200
committerPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2014-09-09 13:49:31 +0200
commitc228b36ccf92f3a75d7687159d99da496cf5e241 (patch)
treea4222f1f5aa795903f6b16fd2a3d4fe2821b5c42 /src/plugins/cpptools/cppcompletion_test.cpp
parentbf0e0d80aa2cd8fc99c036f0a90c497cf7809520 (diff)
downloadqt-creator-c228b36ccf92f3a75d7687159d99da496cf5e241.tar.gz
C++: add support for resolving typedefs for template arguments
Example: template <typename T> struct Base { T t; }; struct Foo { int foo; }; void fun() { typedef Foo TypedefedFoo; Base<TypedefedFoo> baseFoo; baseFoo.t.// no code completion } Change-Id: I4822693d3fa1ee2e9b0e4cdd28bb9a8d441fb313 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index 679e141b75..0f12e36b07 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -2328,6 +2328,34 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("foo")
<< QLatin1String("Foo"));
+ QTest::newRow("resolving_template_argument1") << _(
+ "template <typename T>\n"
+ "struct Base { T t; };\n"
+ "struct Foo { int foo; };\n"
+ "void fun() {\n"
+ " typedef Foo TypedefedFoo;\n"
+ " Base<TypedefedFoo> baseFoo;\n"
+ " @\n"
+ "}\n"
+ ) << _("baseFoo.t.") << (QStringList()
+ << QLatin1String("foo")
+ << QLatin1String("Foo"));
+
+ QTest::newRow("resolving_template_argument2") << _(
+ "namespace NS {\n"
+ "template <typename T>\n"
+ "struct Base { T t; };\n"
+ "}\n"
+ "struct Foo { int foo; };\n"
+ "void fun() {\n"
+ " typedef Foo TypedefedFoo;\n"
+ " NS::Base<TypedefedFoo> baseFoo;\n"
+ " @\n"
+ "}\n"
+ ) << _("baseFoo.t.") << (QStringList()
+ << QLatin1String("foo")
+ << QLatin1String("Foo"));
+
// this is not a valid code(is not compile) but it caused a crash
QTest::newRow("template_specialization_and_initialization_with_pointer2") << _(
"template <typename T1, typename T2 = int>\n"