From e4fb3de1650e293ec5181653254684f0559f8255 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 22 May 2020 12:39:33 +0200 Subject: C++: Add tests for recent indentation fixes Change-Id: I90ae2da3a82bff2e966c4327cf8e42f7ebbddd27 Reviewed-by: Christian Kandeler --- .../cplusplus/codeformatter/tst_codeformatter.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp b/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp index f54816f9fe..225ef18470 100644 --- a/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp +++ b/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp @@ -125,6 +125,8 @@ private Q_SLOTS: void braceReturn(); void staticVarDeclWithTypeDecl(); void strings(); + void initializerWithinFunctionArg(); + void shiftWithinInitializer(); }; struct Line { @@ -2170,6 +2172,29 @@ void tst_CodeFormatter::strings() checkIndent(data); } +void tst_CodeFormatter::initializerWithinFunctionArg() +{ + QList data; + data << Line("void f() {") + << Line(" g(foo,") + << Line(" { 1, 2});", 4, 2) + << Line("}") + ; + + checkIndent(data); +} + +void tst_CodeFormatter::shiftWithinInitializer() +{ + QList 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) #include "tst_codeformatter.moc" -- cgit v1.2.1