diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-07-05 15:29:19 +0200 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-07-06 10:00:05 +0200 |
commit | e2cdaf7888bd533ffaa074e4721f37c6202557f6 (patch) | |
tree | 8e260cc09f3995753f3856d2c7ad5f8e67fba3ff /tests | |
parent | 2fba2017830703f620d4e427a8c201fe71570235 (diff) |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp b/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp index 3df75d4f37b..9dbe5506a71 100644 --- a/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp +++ b/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp @@ -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; |