diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-02-08 10:47:12 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-02-08 10:47:12 +0000 |
commit | 6e19a38a868acf59198715d73d4db72e92483193 (patch) | |
tree | 1fc0dde10af7fc1437a4da6cf0b4cdfc15bd6d1f /unittests/Format/FormatTestProto.cpp | |
parent | 4baa2a7fd0c866c7badaaf49c7faff59e0a49e3e (diff) | |
download | clang-6e19a38a868acf59198715d73d4db72e92483193.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324591 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTestProto.cpp')
-rw-r--r-- | unittests/Format/FormatTestProto.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp index 3889bc6776..d667ec2b3e 100644 --- a/unittests/Format/FormatTestProto.cpp +++ b/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 |