ClangFormat: Add more unit-tests for if conditions

Change-Id: I4ed68fc6260bfb4b058d5714d64dfec638ae1953
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-04-03 10:26:04 +02:00
parent 17f87a6d82
commit c5a58a9cb5

View File

@@ -404,6 +404,39 @@ TEST_F(ClangFormat, IndentEmptyLineInsideParantheses)
" && b)"));
}
TEST_F(ClangFormat, IndentInsideIf)
{
insertLines({"if (a && b",
")"});
indenter.indentBlock(doc.findBlockByNumber(1), QChar::Null, TextEditor::TabSettings());
ASSERT_THAT(documentLines(), ElementsAre("if (a && b",
" )"));
}
TEST_F(ClangFormat, IndentInsideIf2)
{
insertLines({"if (a && b &&",
")"});
indenter.indentBlock(doc.findBlockByNumber(1), QChar::Null, TextEditor::TabSettings());
ASSERT_THAT(documentLines(), ElementsAre("if (a && b &&",
" )"));
}
TEST_F(ClangFormat, IndentInsideIf3)
{
insertLines({"if (a || b",
")"});
indenter.indentBlock(doc.findBlockByNumber(1), QChar::Null, TextEditor::TabSettings());
ASSERT_THAT(documentLines(), ElementsAre("if (a || b",
" )"));
}
TEST_F(ClangFormat, EmptyLineInInitializerList)
{
insertLines({"Bar foo{a,",