diff --git a/tests/unit/unittest/clangformat-test.cpp b/tests/unit/unittest/clangformat-test.cpp index 731ca4260f3..44217b98761 100644 --- a/tests/unit/unittest/clangformat-test.cpp +++ b/tests/unit/unittest/clangformat-test.cpp @@ -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,",