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 | 94fb72932c806c549f5c51f4bfa99fa7b481324a (patch) | |
tree | 4358c7fc2b93a8dd9044a45fee7c6dd24bbe50fb /unittests/Format/FormatTest.cpp | |
parent | 5dfe9b47a5d52b97ba6452d40edb7ea0e04c4435 (diff) |
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;
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index c3fef1d401..2a2bb3fe6d 100644 --- a/unittests/Format/FormatTest.cpp +++ b/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" |