forked from qt-creator/qt-creator
C++: Add tests for recent indentation fixes
Change-Id: I90ae2da3a82bff2e966c4327cf8e42f7ebbddd27 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
committed by
Nikolai Kosjar
parent
ad379227a9
commit
e4fb3de165
@@ -125,6 +125,8 @@ private Q_SLOTS:
|
|||||||
void braceReturn();
|
void braceReturn();
|
||||||
void staticVarDeclWithTypeDecl();
|
void staticVarDeclWithTypeDecl();
|
||||||
void strings();
|
void strings();
|
||||||
|
void initializerWithinFunctionArg();
|
||||||
|
void shiftWithinInitializer();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Line {
|
struct Line {
|
||||||
@@ -2170,6 +2172,29 @@ void tst_CodeFormatter::strings()
|
|||||||
checkIndent(data);
|
checkIndent(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_CodeFormatter::initializerWithinFunctionArg()
|
||||||
|
{
|
||||||
|
QList<Line> data;
|
||||||
|
data << Line("void f() {")
|
||||||
|
<< Line(" g(foo,")
|
||||||
|
<< Line(" { 1, 2});", 4, 2)
|
||||||
|
<< Line("}")
|
||||||
|
;
|
||||||
|
|
||||||
|
checkIndent(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_CodeFormatter::shiftWithinInitializer()
|
||||||
|
{
|
||||||
|
QList<Line> data;
|
||||||
|
data << Line("void f() {")
|
||||||
|
<< Line(" list << A{1 << 1};")
|
||||||
|
<< Line(" list;") // OK, same indentation/padding as above.
|
||||||
|
<< Line("}")
|
||||||
|
;
|
||||||
|
checkIndent(data);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(tst_CodeFormatter)
|
QTEST_MAIN(tst_CodeFormatter)
|
||||||
|
|
||||||
#include "tst_codeformatter.moc"
|
#include "tst_codeformatter.moc"
|
||||||
|
Reference in New Issue
Block a user