summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
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
commit58c3dee3b3cdf103680d80b61167dda9612d3e0d (patch)
treeb3d064a0cc38f144b707d928f975259699cbf4cb /clang/unittests/Format/FormatTest.cpp
parent2fb44808b1e90a0c8300c93cd411850659e536e7 (diff)
downloadbcm5719-llvm-58c3dee3b3cdf103680d80b61167dda9612d3e0d.tar.gz
bcm5719-llvm-58c3dee3b3cdf103680d80b61167dda9612d3e0d.zip
[clang-format] Wrapped block after case label should not be merged into one line
PR38854 Differential Revision: http://reviews.llvm.org/D51719 llvm-svn: 342116
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index e7c467547a1..70bc9e0ed73 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud