C++ indenter: Don't get confused on 'for (a in b)'.

Reviewed-by: Roberto Raggi
Reviewed-by: Erik Verbruggen
(cherry picked from commit c2d890f65e)
This commit is contained in:
Christian Kamm
2010-10-06 13:50:04 +02:00
parent 074cfd6710
commit 7e3294a8ce
2 changed files with 21 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ private Q_SLOTS:
void classAccess();
void ternary();
void objcAtDeclarations();
void objcCallAndFor();
void braceList();
void bug1();
void bug2();
@@ -666,6 +667,24 @@ void tst_CodeFormatter::objcAtDeclarations()
checkIndent(data);
}
void tst_CodeFormatter::objcCallAndFor()
{
QList<Line> data;
data << Line("void foo() {")
<< Line(" NSArray *windows = [NSApp windows];")
<< Line(" for (NSWindow *window in windows) {")
<< Line(" NSArray *drawers = [window drawers];")
<< Line(" for (NSDrawer *drawer in drawers) {")
<< Line(" NSArray *views = [[drawer contentView] subviews];")
<< Line(" int x;")
<< Line(" }")
<< Line(" }")
<< Line("}")
<< Line("int y;")
;
checkIndent(data);
}
void tst_CodeFormatter::switch1()
{
QList<Line> data;