diff options
author | Krasimir Georgiev <krasimir@google.com> | 2017-06-29 13:30:41 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2017-06-29 13:30:41 +0000 |
commit | 1747f04c528f04f9daa2d77885cc3c27d2553674 (patch) | |
tree | ad450c96f20b717b31cc77d6b382fca40e29a277 /unittests | |
parent | ba2af70d9cfaddc5b8c2fa6e2a55387025b8f3ee (diff) |
[clang-format] Fix parsing of msg{field}-style proto options
Summary:
This patch makes the `{` in `msg_field{field: OK}` in a proto option scope be
treated as an assignment operator. Previosly the added test case was formatted
as:
```
option (MyProto.options) = {
field_a: OK
field_b{field_c: OK} field_d: OKOKOK field_e: OK
}
```
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D34749
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTestProto.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp index 0b052bd4c6..2e3b9311d1 100644 --- a/unittests/Format/FormatTestProto.cpp +++ b/unittests/Format/FormatTestProto.cpp @@ -201,6 +201,12 @@ TEST_F(FormatTestProto, FormatsOptions) { " field_c: \"OK\"\n" " msg_field{field_d: 123}\n" "};"); + verifyFormat("option (MyProto.options) = {\n" + " field_a: OK\n" + " field_b{field_c: OK}\n" + " field_d: OKOKOK\n" + " field_e: OK\n" + "}"); // Support syntax with <> instead of {}. verifyFormat("option (MyProto.options) = {\n" @@ -209,6 +215,13 @@ TEST_F(FormatTestProto, FormatsOptions) { "};"); verifyFormat("option (MyProto.options) = {\n" + " field_a: OK\n" + " field_b<field_c: OK>\n" + " field_d: OKOKOK\n" + " field_e: OK\n" + "}"); + + verifyFormat("option (MyProto.options) = {\n" " msg_field: <>\n" " field_c: \"OK\",\n" " msg_field: <field_d: 123>\n" |