CppEditor: Fix "Move Definition to Class" for template member functions

class Foo
{
    template<class T>
    void func();
};

template<class T>
void Foo::func() {} // Move to class

It currently doesn't trigger at all.

Change-Id: I63d561771a8dd455f01e99dd836abbd23eec71b7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Orgad Shaneh
2016-07-29 19:07:21 +03:00
committed by Orgad Shaneh
parent e7eac98c7e
commit 65dc6d0fc2
3 changed files with 35 additions and 1 deletions

View File

@@ -4416,6 +4416,29 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_template()
QuickFixOperationTest(singleDocument(original, expected), &factory);
}
void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_templateFunction()
{
QByteArray original =
"class Foo\n"
"{\n"
" template<class T>\n"
" void func();\n"
"};\n"
"\n"
"template<class T>\n"
"void Foo::fu@nc() {}\n";
QByteArray expected =
"class Foo\n"
"{\n"
" template<class T>\n"
" void func() {}\n"
"};\n\n\n";
MoveFuncDefToDecl factory;
QuickFixOperationTest(singleDocument(original, expected), &factory);
}
/// Check: Move all definitions from header to cpp.
void CppEditorPlugin::test_quickfix_MoveAllFuncDefOutside_MemberFuncToCpp()
{