diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-22 12:39:33 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2020-05-27 04:45:12 +0000 |
commit | e4fb3de1650e293ec5181653254684f0559f8255 (patch) | |
tree | eadedfc4a05b266a9bfe40d4521233bfde4b38ed | |
parent | ad379227a960829056732aee6e5dc9e07a4a750b (diff) |
C++: Add tests for recent indentation fixes
Change-Id: I90ae2da3a82bff2e966c4327cf8e42f7ebbddd27
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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<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) #include "tst_codeformatter.moc" |