aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2018-09-13 07:27:15 +0000
committerOwen Pan <owenpiano@gmail.com>2018-09-13 07:27:15 +0000
commit903444bc95812173cc7ba92786b9b569e28984e9 (patch)
treec51fb8e1acef0e9fdd649e989aeba9d1dcaba913 /unittests
parentca6d65812f8d6ba6093d0ea0d0bfd9cac518789d (diff)
[clang-format] Wrapped block after case label should not be merged into one line
PR38854 Differential Revision: http://reviews.llvm.org/D51719 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342116 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index e7c467547a..70bc9e0ed7 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1064,6 +1064,32 @@ TEST_F(FormatTest, FormatsSwitchStatement) {
" return;\n"
"}",
getLLVMStyleWithColumns(34));
+
+ FormatStyle Style = getLLVMStyle();
+ Style.IndentCaseLabels = true;
+ Style.AllowShortBlocksOnASingleLine = false;
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.BraceWrapping.AfterControlStatement = true;
+ EXPECT_EQ("switch (n)\n"
+ "{\n"
+ " case 0:\n"
+ " {\n"
+ " return false;\n"
+ " }\n"
+ " default:\n"
+ " {\n"
+ " return true;\n"
+ " }\n"
+ "}",
+ format("switch (n) {\n"
+ " case 0: {\n"
+ " return false;\n"
+ " }\n"
+ " default: {\n"
+ " return true;\n"
+ " }\n"
+ "}",
+ Style));
}
TEST_F(FormatTest, CaseRanges) {