forked from qt-creator/qt-creator
ClangFormat: Indent closing brace on the new line
Sometimes the curly brace also requires indentation. These are the cases when it comes directly after the comma, for example inside the initializer list. Lets handle such cases in the similar way we do it for the closing parenthesis. Change-Id: Ia0d25fa08f7224567dd41dd17f9757d9d8b27362 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -417,6 +417,30 @@ TEST_F(ClangFormat, EmptyLineInInitializerList)
|
||||
"};"));
|
||||
}
|
||||
|
||||
TEST_F(ClangFormat, IndentClosingBraceAfterComma)
|
||||
{
|
||||
insertLines({"Bar foo{a,",
|
||||
"}"});
|
||||
|
||||
indenter.indentBlock(doc.findBlockByNumber(1), QChar::Null, TextEditor::TabSettings());
|
||||
|
||||
ASSERT_THAT(documentLines(), ElementsAre("Bar foo{a,",
|
||||
" }"));
|
||||
}
|
||||
|
||||
TEST_F(ClangFormat, DoNotIndentClosingBraceAfterSemicolon)
|
||||
{
|
||||
insertLines({"{",
|
||||
" a;"
|
||||
"}"});
|
||||
|
||||
indenter.indentBlock(doc.findBlockByNumber(2), QChar::Null, TextEditor::TabSettings());
|
||||
|
||||
ASSERT_THAT(documentLines(), ElementsAre("{",
|
||||
" a;"
|
||||
"}"));
|
||||
}
|
||||
|
||||
TEST_F(ClangFormat, IndentFunctionBodyButNotFormatBeforeIt)
|
||||
{
|
||||
insertLines({"int foo(int a, int b,",
|
||||
|
||||
Reference in New Issue
Block a user