diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-02-15 15:30:22 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-02-15 15:30:22 +0000 |
commit | b79987a95b1b32ec47ee6d5af0fda15d489e02c1 (patch) | |
tree | 017ef751a062e6e935036c3330ddc8ab32ea8669 /clang/unittests/Format/FormatTestProto.cpp | |
parent | 1e002a2b1b4249003124fe7b098736447a64f713 (diff) | |
download | bcm5719-llvm-b79987a95b1b32ec47ee6d5af0fda15d489e02c1.tar.gz bcm5719-llvm-b79987a95b1b32ec47ee6d5af0fda15d489e02c1.zip |
[clang-format] Support repeated field lists in protos
Summary:
This patch adds support for list initialization of proto repeated fields:
```
keys: [1, 2, 3]
```
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43298
llvm-svn: 325252
Diffstat (limited to 'clang/unittests/Format/FormatTestProto.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestProto.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp index 40a069b3f3d..4c61ec1398f 100644 --- a/clang/unittests/Format/FormatTestProto.cpp +++ b/clang/unittests/Format/FormatTestProto.cpp @@ -438,5 +438,35 @@ TEST_F(FormatTestProto, NoSpaceAfterPercent) { "};"); } +TEST_F(FormatTestProto, FormatsRepeatedListInitializersInOptions) { + verifyFormat("option (MyProto.options) = {\n" + " key: item\n" + " keys: [\n" + " 'ala',\n" + " 'bala',\n" + " 'porto',\n" + " 'kala',\n" + " 'too',\n" + " 'long',\n" + " 'long',\n" + " 'long'\n" + " ]\n" + " key: [ item ]\n" + " msg {\n" + " key: item\n" + " keys: [\n" + " 'ala',\n" + " 'bala',\n" + " 'porto',\n" + " 'kala',\n" + " 'too',\n" + " 'long',\n" + " 'long'\n" + " ]\n" + " }\n" + " key: value\n" + "};"); +} + } // end namespace tooling } // end namespace clang |