From 783ec18424289301bdf598e9a19dfb55f0847be9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Gorszkowski Date: Thu, 16 May 2013 10:20:36 +0200 Subject: C++: instantiate template functions Task-number: QTCREATORBUG-9170 Change-Id: I4cac9124558c1d4f0722192246f3fbeea61d3d7d Reviewed-by: Erik Verbruggen --- src/plugins/cpptools/cppcompletion_test.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/plugins/cpptools/cppcompletion_test.cpp') diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 385777de30..c1012f3527 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -2047,3 +2047,32 @@ void CppToolsPlugin::test_completion_instantiate_template_with_anonymous_class() QCOMPARE(completions.size(), 1); QVERIFY(completions.contains(QLatin1String("S"))); } + +void CppToolsPlugin::test_completion_instantiate_template_function() +{ + TestData data; + data.srcText = + "template \n" + "T* templateFunction() { return 0; }\n" + "struct A { int a; };\n" + "void foo()\n" + "{\n" + " @\n" + " // padding so we get the scope right\n" + "}\n" + ; + setup(&data); + + Utils::ChangeSet change; + QString txt = QLatin1String("templateFunction()->"); + 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("A"))); + QVERIFY(completions.contains(QLatin1String("a"))); +} -- cgit v1.2.1