summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-03-15 14:57:30 +0000
committerDaniel Jasper <djasper@google.com>2013-03-15 14:57:30 +0000
commit9b33424d6fbb7fb407db886bb702e6fd34cb22ad (patch)
treeda7821ef572d781e11cedb50563047f71eefb0f1 /clang/unittests/Format/FormatTest.cpp
parent845b57537036da9baf1596c42f5411958270be3f (diff)
downloadbcm5719-llvm-9b33424d6fbb7fb407db886bb702e6fd34cb22ad.tar.gz
bcm5719-llvm-9b33424d6fbb7fb407db886bb702e6fd34cb22ad.zip
Improve formatting of chained calls.
clang-format already prevented sequences like: ... SomeParameter).someFunction( ... as those are quite confusing. This failed on: ... SomeParameter).someFunction(otherFunction( ... Fixed in this patch. llvm-svn: 177157
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 4034d1a7b80..4ac9bce56be 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1720,6 +1720,12 @@ TEST_F(FormatTest, WrapsAtFunctionCallsIfNecessary) {
" .WillRepeatedly(Return(SomeValue));");
verifyFormat("SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)]\n"
" .insert(ccccccccccccccccccccccc);");
+ verifyFormat(
+ "aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
+ " .aaaaaaaaaaaaaaa(\n"
+ " aa(aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaa));");
// Here, it is not necessary to wrap at "." or "->".
verifyFormat("if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaa) ||\n"
@@ -1737,6 +1743,10 @@ TEST_F(FormatTest, WrapsAtFunctionCallsIfNecessary) {
verifyFormat("a->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() ||\n"
" aaaaaaaaa()->aaaaaa()->aaaaa());");
+ // FIXME: Should we break before .a()?
+ verifyFormat("aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).a();");
+
FormatStyle NoBinPacking = getLLVMStyle();
NoBinPacking.BinPackParameters = false;
verifyFormat("aaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa)\n"
OpenPOWER on IntegriCloud