aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppquickfix_test.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2016-07-31 23:54:48 +0300
committerOrgad Shaneh <orgads@gmail.com>2016-08-19 14:41:25 +0000
commit5a40bddf08c18eaa3cc55e46d36f561730d0b3cf (patch)
tree66b88a28a56192d9f653ea1b2b55eceb378c5ea1 /src/plugins/cppeditor/cppquickfix_test.cpp
parent2890966ec30fabe09e7ddb325bdc09320bbb17bd (diff)
CppEditor: Add template enclosing scope on "Insert Declaration"
Change-Id: Iff4893193b56c2ed86b4b9515a1a1df847528369 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfix_test.cpp')
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index 5b2c7a9e25..d9fd1d38b3 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -2715,6 +2715,56 @@ void CppEditorPlugin::test_quickfix_InsertDeclFromDef()
insertToSectionDeclFromDef("private slots", 5);
}
+void CppEditorPlugin::test_quickfix_InsertDeclFromDef_templateFuncTypename()
+{
+ QByteArray original =
+ "class Foo\n"
+ "{\n"
+ "};\n"
+ "\n"
+ "template<class T>\n"
+ "void Foo::fu@nc() {}\n";
+
+ QByteArray expected =
+ "class Foo\n"
+ "{\n"
+ "public:\n"
+ " template<class T>\n"
+ " void func();\n"
+ "};\n"
+ "\n"
+ "template<class T>\n"
+ "void Foo::fu@nc() {}\n";
+
+ InsertDeclFromDef factory;
+ QuickFixOperationTest(singleDocument(original, expected), &factory, {}, 0);
+}
+
+void CppEditorPlugin::test_quickfix_InsertDeclFromDef_templateFuncInt()
+{
+ QByteArray original =
+ "class Foo\n"
+ "{\n"
+ "};\n"
+ "\n"
+ "template<int N>\n"
+ "void Foo::fu@nc() {}\n";
+
+ QByteArray expected =
+ "class Foo\n"
+ "{\n"
+ "public:\n"
+ " template<int N>\n"
+ " void func();\n"
+ "};\n"
+ "\n"
+ "template<int N>\n"
+ "void Foo::fu@nc() {}\n";
+
+ InsertDeclFromDef factory;
+ QuickFixOperationTest(singleDocument(original, expected), &factory, {}, 0);
+}
+
void CppEditorPlugin::test_quickfix_InsertDeclFromDef_notTriggeredForTemplateFunc()
{
QByteArray contents =