From a6469cd80d2064e52854093b689cbeb8bbbb76af Mon Sep 17 00:00:00 2001 From: Krasimir Georgiev Date: Tue, 6 Feb 2018 11:34:34 +0000 Subject: [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 --- unittests/Format/FormatTestProto.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'unittests/Format/FormatTestProto.cpp') 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: \n" + " msg_field: < field_d: 123 >\n" + " empty: <>\n" + " empty <>\n" "};"); verifyFormat("option (MyProto.options) = {\n" " field_a: OK\n" - " field_b \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: \n" + " msg_field: < field_d: 123 >\n" " field_e: OK\n" - " msg_field: \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 \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 \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 \n" + " data < key: value >\n" ">;"); verifyFormat("option (MyProto.options) = {\n" -- cgit v1.2.1