forked from qt-creator/qt-creator
C++ indenter: Fix indentation after namespace aliases.
Task-number: QTCREATORBUG-2574 Reviewed-by: Roberto Raggi
This commit is contained in:
@@ -93,6 +93,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
|
|||||||
case namespace_start:
|
case namespace_start:
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case T_LBRACE: enter(namespace_open); break;
|
case T_LBRACE: enter(namespace_open); break;
|
||||||
|
case T_SEMICOLON:
|
||||||
case T_RBRACE: leave(); break;
|
case T_RBRACE: leave(); break;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ private Q_SLOTS:
|
|||||||
void forStatement();
|
void forStatement();
|
||||||
void templateSingleline();
|
void templateSingleline();
|
||||||
void macrosNoSemicolon2();
|
void macrosNoSemicolon2();
|
||||||
|
void renamedNamespace();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Line {
|
struct Line {
|
||||||
@@ -985,6 +986,20 @@ void tst_CodeFormatter::macrosNoSemicolon2()
|
|||||||
checkIndent(data);
|
checkIndent(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_CodeFormatter::renamedNamespace()
|
||||||
|
{
|
||||||
|
QList<Line> data;
|
||||||
|
data
|
||||||
|
<< Line("namespace X = Y;")
|
||||||
|
<< Line("void foo()")
|
||||||
|
<< Line("{")
|
||||||
|
<< Line(" return;")
|
||||||
|
<< Line("}")
|
||||||
|
<< Line("int i;")
|
||||||
|
;
|
||||||
|
checkIndent(data);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN(tst_CodeFormatter)
|
QTEST_APPLESS_MAIN(tst_CodeFormatter)
|
||||||
#include "tst_codeformatter.moc"
|
#include "tst_codeformatter.moc"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user