summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppquickfix_test.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2021-09-10 16:37:50 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2021-09-14 08:22:27 +0000
commit50046dbc54f6457f30b450e7294c357ba9f422b9 (patch)
treebfa787b11ed4fbfe3122884a27b4cc7b636a5f0c /src/plugins/cppeditor/cppquickfix_test.cpp
parent1faff324cd9c7b09d0a9e9708213f2184670530d (diff)
downloadqt-creator-50046dbc54f6457f30b450e7294c357ba9f422b9.tar.gz
CppEditor: Fix "decl from def" quickfix with templated return type
We must treat return and parameters types of the function differently from the function itself with regards to template parameters. This was already done for parameters, but not for the return type. Fixes: QTCREATORBUG-26248 Change-Id: I44cf6f0bda7b5e3c38f9f73e13f51f2c12ab7dc4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfix_test.cpp')
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index 30670b6f77..95b2441e68 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -4614,7 +4614,7 @@ void QuickfixTest::testInsertDefFromDeclTemplateFunction()
"};\n"
"\n"
"template<class T>\n"
- "void Foo::func<T>()\n"
+ "void Foo::func()\n"
"{\n"
"\n"
"}\n";
@@ -4939,6 +4939,28 @@ void QuickfixTest::testInsertDeclFromDefTemplateFuncInt()
QuickFixOperationTest(singleDocument(original, expected), &factory, {}, 0);
}
+void QuickfixTest::testInsertDeclFromDefTemplateReturnType()
+{
+ QByteArray original =
+ "class Foo\n"
+ "{\n"
+ "};\n"
+ "\n"
+ "std::vector<int> Foo::fu@nc() const {}\n";
+
+ QByteArray expected =
+ "class Foo\n"
+ "{\n"
+ "public:\n"
+ " std::vector<int> func() const;\n"
+ "};\n"
+ "\n"
+ "std::vector<int> Foo::func() const {}\n";
+
+ InsertDeclFromDef factory;
+ QuickFixOperationTest(singleDocument(original, expected), &factory, {}, 0);
+}
+
void QuickfixTest::testInsertDeclFromDefNotTriggeredForTemplateFunc()
{
QByteArray contents =