diff options
author | Nico Weber <nicolasweber@gmx.de> | 2013-01-18 05:50:57 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2013-01-18 05:50:57 +0000 |
commit | a5510af53e9e18ae106a222f84fde38b524989bf (patch) | |
tree | 18979fce280146e8829e3ad7c5ff80848b8039eb /clang/unittests/Format/FormatTest.cpp | |
parent | 45d9f4b569d388a66bbc7f99fdc4778195a7f89b (diff) | |
download | bcm5719-llvm-a5510af53e9e18ae106a222f84fde38b524989bf.tar.gz bcm5719-llvm-a5510af53e9e18ae106a222f84fde38b524989bf.zip |
Formatter: After case blocks, "break" goes on the same line as the "}", PR14907.
Before:
switch (foo) {
case a: {
int a = g();
h(a);
}
break;
}
Now:
switch (foo) {
case a: {
int a = g();
h(a);
} break;
}
llvm-svn: 172789
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index c3fef1d4015..2a2bb3fe6d9 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -274,6 +274,32 @@ TEST_F(FormatTest, FormatsSwitchStatement) { " break;\n" "}\n" "}"); + verifyFormat("switch (x) {\n" + "case 1: {\n" + " f();\n" + " {\n" + " g();\n" + " h();\n" + " }\n" + " break;\n" + "}\n" + "}"); + verifyFormat("switch (x) {\n" + "case 1: {\n" + " f();\n" + " if (foo) {\n" + " g();\n" + " h();\n" + " }\n" + " break;\n" + "}\n" + "}"); + verifyFormat("switch (x) {\n" + "case 1: {\n" + " f();\n" + " g();\n" + "} break;\n" + "}"); verifyFormat("switch (test)\n" " ;"); verifyGoogleFormat("switch (x) {\n" |