CppTools: Handle operator functions when reformatting */& declarations

Respect also whitespace within the operator names (e.g. "operator=" vs
"operator =").

Change-Id: Ibdfc77e9eebf7e3db31ccce7d8959b226dcda765
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-06-07 17:42:44 +02:00
parent 50a900e509
commit 546d297856
3 changed files with 33 additions and 8 deletions

View File

@@ -347,6 +347,11 @@ void CppToolsPlugin::test_format_pointerdeclaration_in_simpledeclarations_data()
source = QLatin1String("@char bla;"); // Two spaces to get sure nothing is reformatted.
QTest::newRow("precondition-fail-no-pointer")
<< source << stripCursor(source);
// Respect white space within operator names
QTest::newRow("operators")
<< "class C { C@&operator = (const C &); };"
<< "class C { C & operator = (const C &); };";
}
void CppToolsPlugin::test_format_pointerdeclaration_in_controlflowstatements()