diff options
author | dim <dim@FreeBSD.org> | 2016-01-06 20:02:26 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-01-06 20:02:26 +0000 |
commit | fc74ff5a0792641885551a63d9ddf8cbfdf76e3c (patch) | |
tree | 955a1295c3fd4378a49478ad5835ca21b769417e /unittests/Format/FormatTestProto.cpp | |
parent | 3176e97f130184ece0e1a21352c8124cc83ff24a (diff) | |
download | FreeBSD-src-fc74ff5a0792641885551a63d9ddf8cbfdf76e3c.zip FreeBSD-src-fc74ff5a0792641885551a63d9ddf8cbfdf76e3c.tar.gz |
Vendor import of clang trunk r256945:
https://llvm.org/svn/llvm-project/cfe/trunk@256945
Diffstat (limited to 'unittests/Format/FormatTestProto.cpp')
-rw-r--r-- | unittests/Format/FormatTestProto.cpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp index cd2c0c8..d3d3d42 100644 --- a/unittests/Format/FormatTestProto.cpp +++ b/unittests/Format/FormatTestProto.cpp @@ -88,9 +88,10 @@ TEST_F(FormatTestProto, UnderstandsReturns) { TEST_F(FormatTestProto, MessageFieldAttributes) { verifyFormat("optional string test = 1 [default = \"test\"];"); verifyFormat("optional bool a = 1 [default = true, deprecated = true];"); - verifyFormat("optional LongMessageType long_proto_field = 1\n" - " [default = REALLY_REALLY_LONG_CONSTANT_VALUE,\n" - " deprecated = true];"); + verifyFormat("optional LongMessageType long_proto_field = 1 [\n" + " default = REALLY_REALLY_LONG_CONSTANT_VALUE,\n" + " deprecated = true\n" + "];"); verifyFormat("optional LongMessageType long_proto_field = 1\n" " [default = REALLY_REALLY_LONG_CONSTANT_VALUE];"); verifyFormat("repeated double value = 1\n" @@ -103,6 +104,16 @@ TEST_F(FormatTestProto, MessageFieldAttributes) { " aaaaaaaaaaaaaaaa: AAAAAAAAAA\n" " bbbbbbbbbbbbbbbb: BBBBBBBBBB\n" "}];"); + verifyFormat("repeated double value = 1 [\n" + " (aaaaaaa.aaaaaaaaa) = {\n" + " aaaaaaaaaaaaaaaa: AAAAAAAAAA\n" + " bbbbbbbbbbbbbbbb: BBBBBBBBBB\n" + " },\n" + " (bbbbbbb.bbbbbbbbb) = {\n" + " aaaaaaaaaaaaaaaa: AAAAAAAAAA\n" + " bbbbbbbbbbbbbbbb: BBBBBBBBBB\n" + " }\n" + "];"); verifyFormat("repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {\n" " type: \"AAAAAAAAAA\"\n" " is: \"AAAAAAAAAA\"\n" @@ -113,6 +124,14 @@ TEST_F(FormatTestProto, MessageFieldAttributes) { " bbbbbbb: BBBB,\n" " bbbb: BBB\n" "}];"); + verifyFormat("optional AAA aaa = 1 [\n" + " foo = {\n" + " key: 'a' //\n" + " },\n" + " bar = {\n" + " key: 'a' //\n" + " }\n" + "];"); } TEST_F(FormatTestProto, DoesntWrapFileOptions) { @@ -130,7 +149,6 @@ 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: \"OK\"\n" @@ -140,18 +158,22 @@ TEST_F(FormatTestProto, FormatsOptions) { " field_e: OK\n" " }\n" "};"); - verifyFormat("option (MyProto.options) = {\n" " field_a: OK // Comment\n" " field_b: \"OK\"\n" " field_c: \"OK\"\n" " msg_field: {field_d: 123}\n" "};"); - verifyFormat("option (MyProto.options) = {\n" " field_c: \"OK\"\n" " msg_field{field_d: 123}\n" "};"); + + // Support syntax with <> instead of {}. + verifyFormat("option (MyProto.options) = {\n" + " field_c: \"OK\",\n" + " msg_field: <field_d: 123>\n" + "};"); } TEST_F(FormatTestProto, FormatsService) { |