summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2013-04-13 08:40:54 +0200
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-04-17 14:10:32 +0200
commit17cd161a9d265db12ba763e090111f0fb27fbab9 (patch)
tree2250bab97309e0a4e5013e904356d0816e2946cd /src/plugins/cpptools/cppcompletion_test.cpp
parentb55961d22583257cf6e4901e71dfc7d8226a515e (diff)
downloadqt-creator-17cd161a9d265db12ba763e090111f0fb27fbab9.tar.gz
C++: fix cloning of templates
Fix instantiation of templates(by cloning original symbols). Assigning of scope for cloned symbol is taken from the symbol which is used to instantiate. Task-number: QTCREATORBUG-9098 Change-Id: I066cc8b5f69333fabdaf2d4466b205baf08bd3f1 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.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index 0af9130e96..b8ee95f7c0 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -1843,3 +1843,42 @@ void CppToolsPlugin::test_completion_namespace_alias_with_many_namespace_declara
QVERIFY(completions.contains(QLatin1String("Foo1")));
QVERIFY(completions.contains(QLatin1String("Foo2")));
}
+
+void CppToolsPlugin::test_completion_QTCREATORBUG9098()
+{
+ TestData data;
+ data.srcText =
+ "template <typename T>\n"
+ "class B\n"
+ "{\n"
+ "public:\n"
+ " C<T> c;\n"
+ "};\n"
+ "template <typename T>\n"
+ "class A\n"
+ "{\n"
+ "public:\n"
+ " B<T> b;\n"
+ " void fun()\n"
+ " {\n"
+ " @\n"
+ " // padding so we get the scope right\n"
+ " }\n"
+ "};\n"
+
+ ;
+ setup(&data);
+
+ Utils::ChangeSet change;
+ QString txt = QLatin1String("b.");
+ 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("c")));
+ QVERIFY(completions.contains(QLatin1String("B")));
+}