C++ indenter: Respect user indent with stream operators.

Reviewed-by: Erik Verbruggen
This commit is contained in:
Christian Kamm
2010-07-15 16:14:22 +02:00
parent 9b24e0ae2a
commit 1a61ae01cb
3 changed files with 39 additions and 6 deletions

View File

@@ -44,6 +44,7 @@ private Q_SLOTS:
void whitesmithsStyle();
void singleLineEnum();
void functionReturnType();
void streamOp();
};
struct Line {
@@ -786,6 +787,27 @@ void tst_CodeFormatter::functionReturnType()
checkIndent(data);
}
void tst_CodeFormatter::streamOp()
{
QList<Line> data;
data
<< Line("void foo () {")
<< Line(" qDebug() << foo")
<< Line(" << bar << moose")
<< Line(" << bar +")
<< Line(" foo - blah(1)")
<< Line(" << '?'")
<< Line(" << \"\\n\";")
<< Line(" qDebug() << foo")
<< Line(" << bar << moose", 13)
<< Line(" << bar +")
<< Line(" foo - blah(1)")
<< Line(" << '?'")
<< Line(" << \"\\n\";")
;
checkIndent(data);
}
QTEST_APPLESS_MAIN(tst_CodeFormatter)
#include "tst_codeformatter.moc"