summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 61973c621c7..ac5184ef02b 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -588,6 +588,23 @@ TEST_F(FormatTest, FormatShortBracedStatements) {
AllowSimpleBracedStatements);
}
+TEST_F(FormatTest, ShortBlocksInMacrosDontMergeWithCodeAfterMacro) {
+ FormatStyle Style = getLLVMStyleWithColumns(60);
+ Style.AllowShortBlocksOnASingleLine = true;
+ Style.AllowShortIfStatementsOnASingleLine = true;
+ Style.BreakBeforeBraces = FormatStyle::BS_Allman;
+ EXPECT_EQ("#define A \\\n"
+ " if (HANDLEwernufrnuLwrmviferuvnierv) \\\n"
+ " { RET_ERR1_ANUIREUINERUIFNIOAerwfwrvnuier; }\n"
+ "X;",
+ format("#define A \\\n"
+ " if (HANDLEwernufrnuLwrmviferuvnierv) { \\\n"
+ " RET_ERR1_ANUIREUINERUIFNIOAerwfwrvnuier; \\\n"
+ " }\n"
+ "X;",
+ Style));
+}
+
TEST_F(FormatTest, ParseIfElse) {
verifyFormat("if (true)\n"
" if (true)\n"
OpenPOWER on IntegriCloud