diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-23 12:27:43 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-23 12:27:43 +0000 |
commit | 7006e7ebc0098b7627bd3cc13367ea576c25dcbb (patch) | |
tree | 8803193ad84cfd24a501508c982b002c95977159 /unittests/Format/FormatTest.cpp | |
parent | 4bfc65aab5408f76dfe38e3f4e4375fadeda3bc3 (diff) |
Removing the penalty for breaking after "=".
Having seen more cases, this actually was not a good thing to do in the
first place. We can still improve on what we do now, but breaking after
the "=" is good in many cases.
Before:
aaaaaaaaaaaaa = aa->aaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaa));
After:
aaaaaaaaaaaaa =
aa->aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaa));
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 3a1cfb261b..279b61c262 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -1030,15 +1030,15 @@ TEST_F(FormatTest, BreaksAccordingToOperatorPrecedence) { " ccccccccccccccccccccccccc) {\n}"); } -TEST_F(FormatTest, PrefersNotToBreakAfterAssignments) { +TEST_F(FormatTest, BreaksAfterAssignments) { verifyFormat( - "unsigned Cost = TTI.getMemoryOpCost(I->getOpcode(), VectorTy,\n" - " SI->getAlignment(),\n" - " SI->getPointerAddressSpaceee());\n"); + "unsigned Cost =\n" + " TTI.getMemoryOpCost(I->getOpcode(), VectorTy, SI->getAlignment(),\n" + " SI->getPointerAddressSpaceee());\n"); verifyFormat( - "CharSourceRange LineRange = CharSourceRange::getTokenRange(\n" - " Line.Tokens.front().Tok.getLocation(),\n" - " Line.Tokens.back().Tok.getLocation());"); + "CharSourceRange LineRange =\n" + " CharSourceRange::getTokenRange(Line.Tokens.front().Tok.getLoc(),\n" + " Line.Tokens.back().Tok.getLoc());"); } TEST_F(FormatTest, AlignsAfterAssignments) { @@ -1055,9 +1055,9 @@ TEST_F(FormatTest, AlignsAfterAssignments) { "int Result = (aaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaa +\n" " aaaaaaaaaaaaaaaaaaaaaaaaa);"); verifyFormat( - "double LooooooooooooooooooooooooongResult = aaaaaaaaaaaaaaaaaaaaaaaa +\n" - " aaaaaaaaaaaaaaaaaaaaaaaa +\n" - " aaaaaaaaaaaaaaaaaaaaaaaa;"); + "double LooooooooooooooooooooooooongResult =\n" + " aaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaa +\n" + " aaaaaaaaaaaaaaaaaaaaaaaa;"); } TEST_F(FormatTest, AlignsAfterReturn) { @@ -1133,9 +1133,8 @@ TEST_F(FormatTest, UnderstandsEquals) { "}"); verifyFormat( - // FIXME: Does an expression like this ever make sense? If yes, fix. - "if (int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 100000000 +\n" - " 10000000) {\n}"); + "if (int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =\n" + " 100000000 + 10000000) {\n}"); } TEST_F(FormatTest, WrapsAtFunctionCallsIfNecessary) { |