C++ indenter: Add autotest for C++0x 'for' statement.

Reviewed-by: trustme
This commit is contained in:
Christian Kamm
2010-10-20 10:48:43 +02:00
parent 009d5cd045
commit e7a6bae170

View File

@@ -52,6 +52,7 @@ private Q_SLOTS:
void templateSingleline(); void templateSingleline();
void macrosNoSemicolon2(); void macrosNoSemicolon2();
void renamedNamespace(); void renamedNamespace();
void cpp0xFor();
}; };
struct Line { struct Line {
@@ -1000,6 +1001,24 @@ void tst_CodeFormatter::renamedNamespace()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::cpp0xFor()
{
QList<Line> data;
data
<< Line("void foo()")
<< Line("{")
<< Line(" vector<int> x = setup();")
<< Line(" for(int p : x) {")
<< Line(" bar(p);")
<< Line(" }")
<< Line("}")
<< Line("void car()")
<< Line("{")
<< Line(" int i;")
;
checkIndent(data);
}
QTEST_APPLESS_MAIN(tst_CodeFormatter) QTEST_APPLESS_MAIN(tst_CodeFormatter)
#include "tst_codeformatter.moc" #include "tst_codeformatter.moc"