summaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTestProto.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-02-06 11:34:34 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-02-06 11:34:34 +0000
commita6469cd80d2064e52854093b689cbeb8bbbb76af (patch)
tree5cc7551de7aa5c83d250b0de83646a63192e6b75 /unittests/Format/FormatTestProto.cpp
parente77fed96933e0fa11bd4cd8dc8a198a34649c6ea (diff)
downloadclang-a6469cd80d2064e52854093b689cbeb8bbbb76af.tar.gz
[clang-format] Adds space around angle brackets in text protos
Summary: This patch adds spaces around angle brackets in text proto Google style. Previously these were detected as template openers and closers, which happened to have the expected effect. Now we detect them as scope openers and closers similarly to the way braces are handled in this context. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42727 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTestProto.cpp')
-rw-r--r--unittests/Format/FormatTestProto.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp
index 4d52a61dc3..3889bc6776 100644
--- a/unittests/Format/FormatTestProto.cpp
+++ b/unittests/Format/FormatTestProto.cpp
@@ -211,12 +211,14 @@ TEST_F(FormatTestProto, FormatsOptions) {
// Support syntax with <> instead of {}.
verifyFormat("option (MyProto.options) = {\n"
" field_c: \"OK\",\n"
- " msg_field: <field_d: 123>\n"
+ " msg_field: < field_d: 123 >\n"
+ " empty: <>\n"
+ " empty <>\n"
"};");
verifyFormat("option (MyProto.options) = {\n"
" field_a: OK\n"
- " field_b <field_c: OK>\n"
+ " field_b < field_c: OK >\n"
" field_d: OKOKOK\n"
" field_e: OK\n"
"}");
@@ -224,9 +226,9 @@ TEST_F(FormatTestProto, FormatsOptions) {
verifyFormat("option (MyProto.options) = {\n"
" msg_field: <>\n"
" field_c: \"OK\",\n"
- " msg_field: <field_d: 123>\n"
+ " msg_field: < field_d: 123 >\n"
" field_e: OK\n"
- " msg_field: <field_d: 12>\n"
+ " msg_field: < field_d: 12 >\n"
"};");
verifyFormat("option (MyProto.options) = <\n"
@@ -350,7 +352,7 @@ TEST_F(FormatTestProto, FormatsOptions) {
" field_D: 4\n"
" field_E: 5\n"
" >\n"
- " msg_field <field_A: 1 field_B: 2 field_C: 3 field_D: 4>\n"
+ " msg_field < field_A: 1 field_B: 2 field_C: 3 f_D: 4 >\n"
" field_e: OK\n"
" field_f: OK\n"
" }\n"
@@ -358,14 +360,14 @@ TEST_F(FormatTestProto, FormatsOptions) {
">;");
verifyFormat("option (MyProto.options) = <\n"
- " data1 <key1: value1>\n"
+ " data1 < key1: value1 >\n"
" data2 { key2: value2 }\n"
">;");
verifyFormat("option (MyProto.options) = <\n"
" app_id: 'com.javax.swing.salsa.latino'\n"
" head_id: 1\n"
- " data <key: value>\n"
+ " data < key: value >\n"
">;");
verifyFormat("option (MyProto.options) = {\n"