forked from qt-creator/qt-creator
CppEditor: Fix added newlines for GenerateGetterSetter quick fix
As a nice side effect superfluous new lines - introduced by quick fixes that are using InsertionPointLocator::methodDefinition - vanished. Task-number: QTCREATORBUG-13872 Change-Id: Ib3df2b2acbc22449f16f4444092a57ae93d53d35 Reviewed-by: Jochen Becher <jochen_becher@gmx.de> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
03212d6e49
commit
7879aa5fae
@@ -567,6 +567,7 @@ void CppEditorPlugin::test_quickfix_data()
|
||||
" int getIt() const;\n"
|
||||
" void setIt(int value);\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"int Something::getIt() const\n"
|
||||
"{\n"
|
||||
" return it;\n"
|
||||
@@ -1098,7 +1099,6 @@ void CppEditorPlugin::test_quickfix_data()
|
||||
<< CppQuickFixFactoryPtr(new InsertDefFromDecl) << original
|
||||
<< original + _(
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo::Foo()\n"
|
||||
"{\n\n"
|
||||
"}\n"
|
||||
@@ -1772,6 +1772,7 @@ void CppEditorPlugin::test_quickfix_GenerateGetterSetter_basicGetterWithPrefixAn
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"namespace SomeNamespace {\n"
|
||||
"\n"
|
||||
"int Something::getIt() const\n"
|
||||
"{\n"
|
||||
" return it;\n"
|
||||
@@ -1780,7 +1781,8 @@ void CppEditorPlugin::test_quickfix_GenerateGetterSetter_basicGetterWithPrefixAn
|
||||
"void Something::setIt(int value)\n"
|
||||
"{\n"
|
||||
" it = value;\n"
|
||||
"}\n\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"}\n";
|
||||
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
|
||||
|
||||
@@ -2040,7 +2042,6 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_basic2()
|
||||
"\n"
|
||||
"int x;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"void f()\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
@@ -2070,7 +2071,6 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_basic3()
|
||||
" Foo()@;\n"
|
||||
"};\n";
|
||||
expected = original +
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo::Foo()\n"
|
||||
"{\n\n"
|
||||
@@ -2142,7 +2142,6 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_namespace2()
|
||||
"using namespace N;\n"
|
||||
;
|
||||
expected = original +
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo::Foo()\n"
|
||||
"{\n\n"
|
||||
@@ -2304,7 +2303,6 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_respectWsInOperatorNames1(
|
||||
" Foo &operator =();\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo &Foo::operator =()\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
@@ -2328,7 +2326,6 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_respectWsInOperatorNames2(
|
||||
" Foo &operator=();\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo &Foo::operator=()\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
@@ -2512,7 +2509,6 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_findImplementationFile()
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"void Foo::baz()\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
@@ -2551,7 +2547,6 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_unicodeIdentifier()
|
||||
;
|
||||
expected = original;
|
||||
expected +=
|
||||
"\n"
|
||||
"\n"
|
||||
"void Foo::" TEST_UNICODE_IDENTIFIER "()\n"
|
||||
"{\n"
|
||||
@@ -3372,7 +3367,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCpp()
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"int Foo::number() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
@@ -3537,7 +3531,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppNS()
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"int MyNs::Foo::number() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
@@ -3581,7 +3574,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppNSUsing()
|
||||
"#include \"file.h\"\n"
|
||||
"using namespace MyNs;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"int Foo::number() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
@@ -3643,7 +3635,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_FreeFuncToCpp()
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"int number() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
@@ -3681,7 +3672,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_FreeFuncToCppNS()
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"int MyNamespace::number() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
@@ -3723,7 +3713,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_CtorWithInitialization1()
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo::Foo() : a(42), b(3.141) {}\n"
|
||||
;
|
||||
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
|
||||
@@ -3766,7 +3755,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_CtorWithInitialization2()
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo::Foo() : member(2)\n"
|
||||
"{\n"
|
||||
"}\n"
|
||||
@@ -3833,7 +3821,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_respectWsInOperatorNames1
|
||||
" Foo &operator =();\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo &Foo::operator =() {}\n"
|
||||
;
|
||||
|
||||
@@ -3855,7 +3842,6 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_respectWsInOperatorNames2
|
||||
" Foo &operator=();\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"Foo &Foo::operator=() {}\n"
|
||||
;
|
||||
|
||||
@@ -4292,12 +4278,11 @@ void CppEditorPlugin::test_quickfix_MoveAllFuncDefOutside_MemberFuncToCpp()
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"int Foo::numberA() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
"}\n"
|
||||
"\n\n"
|
||||
"\n"
|
||||
"int Foo::numberB() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
@@ -4328,12 +4313,12 @@ void CppEditorPlugin::test_quickfix_MoveAllFuncDefOutside_MemberFuncOutside()
|
||||
" int f1();\n"
|
||||
" int f2() const;\n"
|
||||
"};\n"
|
||||
"\n\n"
|
||||
"\n"
|
||||
"int Foo::f1()\n"
|
||||
"{\n"
|
||||
" return 1;\n"
|
||||
"}\n"
|
||||
"\n\n"
|
||||
"\n"
|
||||
"int Foo::f2() const\n"
|
||||
"{\n"
|
||||
" return 2;\n"
|
||||
@@ -4375,7 +4360,7 @@ void CppEditorPlugin::test_quickfix_MoveAllFuncDefOutside_classWithBaseClass()
|
||||
"class Foo : public Bar {\n"
|
||||
" int f1();\n"
|
||||
"};\n"
|
||||
"\n\n"
|
||||
"\n"
|
||||
"int Foo::f1()\n"
|
||||
"{\n"
|
||||
" return 1;\n"
|
||||
@@ -4403,7 +4388,7 @@ void CppEditorPlugin::test_quickfix_MoveAllFuncDefOutside_ignoreMacroCode()
|
||||
" FAKE_Q_OBJECT\n"
|
||||
" int f1();\n"
|
||||
"};\n"
|
||||
"\n\n"
|
||||
"\n"
|
||||
"int Foo::f1()\n"
|
||||
"{\n"
|
||||
" return 1;\n"
|
||||
|
||||
Reference in New Issue
Block a user