diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-14 14:14:23 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-14 14:14:23 +0000 |
commit | feb18f5ff2cfa952fec4e751eb9665706c4674af (patch) | |
tree | e52c5289db99a5b047ea5db6c2f4113af0ff7f13 /unittests/Format/FormatTest.cpp | |
parent | acd356e18ecb8213d65f1454bb3c1bb4f6892bab (diff) |
Put short if statements on a single line.
Before: if (a)
return;
After: if (a) return;
Not yet sure, whether this is always desired, but we can add options and
make this a style parameter as we go along.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 9565e3a855..e5279c442f 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -130,12 +130,14 @@ TEST_F(FormatTest, FormatsNestedCall) { //===----------------------------------------------------------------------===// TEST_F(FormatTest, FormatIfWithoutCompountStatement) { - verifyFormat("if (true)\n f();\ng();"); - verifyFormat("if (a)\n if (b)\n if (c)\n g();\nh();"); + verifyFormat("if (true) f();\ng();"); + verifyFormat("if (a)\n if (b)\n if (c) g();\nh();"); verifyFormat("if (a)\n if (b) {\n f();\n }\ng();"); verifyFormat("if (a)\n" " // comment\n" " f();"); + verifyFormat("if (a) return;", getLLVMStyleWithColumns(14)); + verifyFormat("if (a)\n return;", getLLVMStyleWithColumns(13)); } TEST_F(FormatTest, ParseIfElse) { @@ -152,8 +154,7 @@ TEST_F(FormatTest, ParseIfElse) { verifyFormat("if (true)\n" " if (true)\n" " if (true) {\n" - " if (true)\n" - " f();\n" + " if (true) f();\n" " } else {\n" " g();\n" " }\n" @@ -1454,8 +1455,7 @@ TEST_F(FormatTest, FormatObjCImplementation) { verifyFormat("@implementation Foo\n" "+ (id)init {\n" - " if (true)\n" - " return nil;\n" + " if (true) return nil;\n" "}\n" "// Look, a comment!\n" "- (int)answerWith:(int)i {\n" |