summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-02-04 07:34:48 +0000
committerDaniel Jasper <djasper@google.com>2013-02-04 07:34:48 +0000
commit2603ee0dc6003be0fbe43038b34580864d1e0c85 (patch)
treeebed4e5e8411eea58e2240bf06db70992cedafea /clang/unittests/Format/FormatTest.cpp
parent1f140981b6af0c8cf0455a9999707a837de071ad (diff)
downloadbcm5719-llvm-2603ee0dc6003be0fbe43038b34580864d1e0c85.tar.gz
bcm5719-llvm-2603ee0dc6003be0fbe43038b34580864d1e0c85.zip
Improve formatting of stream operators.
If there are string literals on either side of a '<<', chances are high that they represent logically separate concepts. Otherwise, the author could just have just a single literal (possible split over multiple lines). So, we can now nicely format things like: cout << "somepacket = {\n" << " val a = " << ValueA << "\n" << " val b = " << ValueB << "\n" << "}"; llvm-svn: 174310
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 17a8dc48abb..3b5256990d1 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1289,6 +1289,13 @@ TEST_F(FormatTest, AlignsPipes) {
"aaaaaaaa << (aaaaaaaaaaaaaaaaaaa << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
" << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
" << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa;");
+
+ verifyFormat("return out << \"somepacket = {\\n\"\n"
+ " << \" aaaaaa = \" << pkt.aaaaaa << \"\\n\"\n"
+ " << \" bbbb = \" << pkt.bbbb << \"\\n\"\n"
+ " << \" cccccc = \" << pkt.cccccc << \"\\n\"\n"
+ " << \" ddd = [\" << pkt.ddd << \"]\\n\"\n"
+ " << \"}\";");
}
TEST_F(FormatTest, UnderstandsEquals) {
OpenPOWER on IntegriCloud