C++: Transfer noexcept specifier for refactoring actions

This applies for e.g.

* "Add Definition..." (on function decl)
* "Move Definition..." (on function decl)
* "Insert Virtual Functions of Base Class" (on class specifier)

Fixes: QTCREATORBUG-11849
Fixes: QTCREATORBUG-19699
Change-Id: I0d259bc1782470f3b3f19617230005a5594a5cca
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Nikolai Kosjar
2019-10-07 14:31:32 +02:00
parent c2aaa93408
commit 54fefd89b8
8 changed files with 49 additions and 2 deletions

View File

@@ -2502,6 +2502,29 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_respectWsInOperatorNames2(
QuickFixOperationTest(singleDocument(original, expected), &factory);
}
/// Check that the noexcept exception specifier is transferred
void CppEditorPlugin::test_quickfix_InsertDefFromDecl_noexcept_specifier()
{
QByteArray original =
"class Foo\n"
"{\n"
" void @foo() noexcept(false);\n"
"};\n";
QByteArray expected =
"class Foo\n"
"{\n"
" void foo() noexcept(false);\n"
"};\n"
"\n"
"void Foo::foo() noexcept(false)\n"
"{\n"
"\n"
"}\n";
InsertDefFromDecl factory;
QuickFixOperationTest(singleDocument(original, expected), &factory);
}
/// Check if a function like macro use is not separated by the function to insert
/// Case: Macro preceded by preproceesor directives and declaration.
void CppEditorPlugin::test_quickfix_InsertDefFromDecl_macroUsesAtEndOfFile1()