diff options
| author | Krasimir Georgiev <krasimir@google.com> | 2018-02-14 19:47:58 +0000 |
|---|---|---|
| committer | Krasimir Georgiev <krasimir@google.com> | 2018-02-14 19:47:58 +0000 |
| commit | 76064a4b1e7fd1d53cdef12300cb21ceccad3e48 (patch) | |
| tree | dcb027179613cff61ee8a39966de425cab3725d8 /clang/unittests/Format | |
| parent | ab31b7759dc3cc02b83c49ce1790aef0db9bf1f0 (diff) | |
| download | bcm5719-llvm-76064a4b1e7fd1d53cdef12300cb21ceccad3e48.tar.gz bcm5719-llvm-76064a4b1e7fd1d53cdef12300cb21ceccad3e48.zip | |
[clang-format] Recognize percents as format specifiers in protos
Summary:
Frequently, a percent in protos denotes a formatting specifier for string replacement.
Thus it is desirable to keep the percent together with what follows after it.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43294
llvm-svn: 325159
Diffstat (limited to 'clang/unittests/Format')
| -rw-r--r-- | clang/unittests/Format/FormatTestProto.cpp | 6 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTestTextProto.cpp | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp index 27ecde7f340..40a069b3f3d 100644 --- a/clang/unittests/Format/FormatTestProto.cpp +++ b/clang/unittests/Format/FormatTestProto.cpp @@ -432,5 +432,11 @@ TEST_F(FormatTestProto, FormatsOptionsExtensions) { "};"); } +TEST_F(FormatTestProto, NoSpaceAfterPercent) { + verifyFormat("option (MyProto.options) = {\n" + " key: %lld\n" + "};"); +} + } // end namespace tooling } // end namespace clang diff --git a/clang/unittests/Format/FormatTestTextProto.cpp b/clang/unittests/Format/FormatTestTextProto.cpp index 8786b270ed5..151774b9e2e 100644 --- a/clang/unittests/Format/FormatTestTextProto.cpp +++ b/clang/unittests/Format/FormatTestTextProto.cpp @@ -386,5 +386,9 @@ TEST_F(FormatTestTextProto, FormatsExtensions) { " }\n" "}"); } + +TEST_F(FormatTestTextProto, NoSpaceAfterPercent) { + verifyFormat("key: %d"); +} } // end namespace tooling } // end namespace clang |

