C++ indenter: Fix function declaration continuation indent.

Change-Id: I0ebe1f0f531cb4830f80b80c6bb52caeaee01353
Reviewed-on: http://codereview.qt.nokia.com/1167
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-07-05 15:29:19 +02:00
parent 2fba201783
commit e2cdaf7888
3 changed files with 51 additions and 13 deletions

View File

@@ -61,9 +61,11 @@ private Q_SLOTS:
void preprocessorContinuation();
void cStyleComments();
void cppStyleComments();
void expressionContinuation();
void expressionContinuation1();
void expressionContinuation2();
void assignContinuation1();
void assignContinuation2();
void declarationContinuation();
void classAccess();
void ternary();
void objcAtDeclarations();
@@ -601,7 +603,7 @@ void tst_CodeFormatter::cppStyleComments()
checkIndent(data);
}
void tst_CodeFormatter::expressionContinuation()
void tst_CodeFormatter::expressionContinuation1()
{
QList<Line> data;
data << Line("void foo() {")
@@ -628,9 +630,27 @@ void tst_CodeFormatter::expressionContinuation()
<< Line(" ~ foo - blah(1)")
<< Line(" ~ << '?'")
<< Line(" ~ << \"\\n\";")
<< Line(" i += foo(")
<< Line("}")
;
checkIndent(data);
}
void tst_CodeFormatter::expressionContinuation2()
{
QList<Line> data;
data << Line("void foo() {")
<< Line(" i += abc +")
<< Line(" ~ foo(,")
<< Line(" ~ bar,")
<< Line(" ~ 2);")
<< Line(" ~ 2")
<< Line(" ~ );")
<< Line(" i += abc +")
<< Line(" ~ foo(,")
<< Line(" ~ bar(")
<< Line(" ~ bar,")
<< Line(" ~ 2")
<< Line(" ~ ),")
<< Line(" ~ abc);")
<< Line("}")
;
checkIndent(data);
@@ -676,6 +696,18 @@ void tst_CodeFormatter::assignContinuation2()
checkIndent(data, style);
}
void tst_CodeFormatter::declarationContinuation()
{
QList<Line> data;
data << Line("void foo(")
<< Line("~ int a,")
<< Line("~ int b);")
<< Line("void foo(int a,")
<< Line("~ int b);")
;
checkIndent(data);
}
void tst_CodeFormatter::classAccess()
{
QList<Line> data;