summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestProto.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-02-08 10:47:12 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-02-08 10:47:12 +0000
commit374e6de8e0378c96fc7d1ea1d58433c81cf34cbe (patch)
treec89c4da120faee4c732bfd7f86fef600be9e4364 /clang/unittests/Format/FormatTestProto.cpp
parent014e4654d496a7c6dfeb28903079bd324c16fc2b (diff)
downloadbcm5719-llvm-374e6de8e0378c96fc7d1ea1d58433c81cf34cbe.tar.gz
bcm5719-llvm-374e6de8e0378c96fc7d1ea1d58433c81cf34cbe.zip
[clang-format] Do not break before long string literals in protos
Summary: This patch is a follow-up to r323319 (which disables string literal breaking for text protos) and it disables breaking before long string literals. For example this: ``` keyyyyy: "long string literal" ``` used to get broken into: ``` keyyyyy: "long string literal" ``` While at it, I also enabled it for LK_Proto and fixed a bug in the mustBreak code. Reviewers: djasper, sammccall Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42957 llvm-svn: 324591
Diffstat (limited to 'clang/unittests/Format/FormatTestProto.cpp')
-rw-r--r--clang/unittests/Format/FormatTestProto.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp
index 3889bc67766..d667ec2b3e9 100644
--- a/clang/unittests/Format/FormatTestProto.cpp
+++ b/clang/unittests/Format/FormatTestProto.cpp
@@ -412,5 +412,14 @@ TEST_F(FormatTestProto, FormatsImports) {
"}");
}
+TEST_F(FormatTestProto, KeepsLongStringLiteralsOnSameLine) {
+ verifyFormat(
+ "option (MyProto.options) = {\n"
+ " foo: {\n"
+ " text: \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasaaaaaaaa\"\n"
+ " }\n"
+ "}");
+}
+
} // end namespace tooling
} // end namespace clang
OpenPOWER on IntegriCloud