diff options
| author | Jonas Toth <jonas.toth@gmail.com> | 2018-09-02 09:04:51 +0000 |
|---|---|---|
| committer | Jonas Toth <jonas.toth@gmail.com> | 2018-09-02 09:04:51 +0000 |
| commit | 81b61a8291b50d2d945b39426806ea4076e129c6 (patch) | |
| tree | 0285a9fc5b50e00838df10039b00197324b542d6 /clang/unittests/Format/FormatTest.cpp | |
| parent | b993cf50d6c87a56c3431e9761cf5b9e5737d597 (diff) | |
| download | bcm5719-llvm-81b61a8291b50d2d945b39426806ea4076e129c6.tar.gz bcm5719-llvm-81b61a8291b50d2d945b39426806ea4076e129c6.zip | |
Fix Bug 38713: clang-format mishandles a short block after "default:" in a switch statement
Summary:
See https://bugs.llvm.org/show_bug.cgi?id=38713
Patch by Owen Pan!
Reviewers: djasper, klimek, sammccall
Reviewed By: sammccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51294
llvm-svn: 341284
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index a603012ccf4..3dd9fc00f68 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -999,6 +999,24 @@ TEST_F(FormatTest, FormatsSwitchStatement) { " }\n" "});", getLLVMStyle())); + EXPECT_EQ("switch (n) {\n" + "case 0: {\n" + " return false;\n" + "}\n" + "default: {\n" + " return true;\n" + "}\n" + "}", + format("switch (n)\n" + "{\n" + "case 0: {\n" + " return false;\n" + "}\n" + "default: {\n" + " return true;\n" + "}\n" + "}", + getLLVMStyle())); verifyFormat("switch (a) {\n" "case (b):\n" " return;\n" |

