C++: fix indentation for static var decls of anonymous classes.

Task-number: QTCREATORBUG-11392

Change-Id: Ie5dd9014383b639e63653e8abc856fea9e620e49
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2014-02-05 13:11:16 +01:00
parent 24a5c3e913
commit 36dccb42fa
2 changed files with 41 additions and 0 deletions

View File

@@ -127,6 +127,7 @@ private Q_SLOTS:
void functionDefaultArgument();
void attributeInAccessSpecifier();
void braceReturn();
void staticVarDeclWithTypeDecl();
};
struct Line {
@@ -2111,6 +2112,43 @@ void tst_CodeFormatter::braceReturn()
checkIndent(data);
}
void tst_CodeFormatter::staticVarDeclWithTypeDecl()
{
QList<Line> data;
data << Line("static class: public Foo {")
<< Line("public:")
<< Line(" int bar();")
<< Line("} mooze;")
<< Line("")
<< Line("static enum Col {")
<< Line(" red,")
<< Line(" yellow,")
<< Line(" green")
<< Line("} Loc;")
<< Line("")
<< Line("static enum {")
<< Line(" red,")
<< Line(" yellow,")
<< Line(" green")
<< Line("} Loc;")
<< Line("")
<< Line("enum class Col {")
<< Line(" red,")
<< Line(" yellow,")
<< Line(" green")
<< Line("};")
<< Line("")
<< Line("static enum class Col")
<< Line("{")
<< Line(" red,")
<< Line(" yellow,")
<< Line(" green")
<< Line("} Loc;")
<< Line("")
;
checkIndent(data);
}
QTEST_MAIN(tst_CodeFormatter)
#include "tst_codeformatter.moc"