diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-06-25 12:43:12 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-06-25 12:43:12 +0000 |
commit | 69593b34c37d3bb5ecc02790118e543522a92b00 (patch) | |
tree | c06b83b4e4d29c29926b4e0d2515795e6eef96a6 /unittests | |
parent | 8d628b252961cdf29d758a1c4da43bbe3957cff2 (diff) |
[clang-format] Keep @message together in text protos
Summary:
In C++ code snippets of the form `@field` are common. This makes clang-format
keep them together in text protos, whereas before it would break them.
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48543
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335459 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTestTextProto.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestTextProto.cpp b/unittests/Format/FormatTestTextProto.cpp index 9c4e1a8520..0875bd8925 100644 --- a/unittests/Format/FormatTestTextProto.cpp +++ b/unittests/Format/FormatTestTextProto.cpp @@ -717,5 +717,23 @@ TEST_F(FormatTestTextProto, FormatsCommentsAtEndOfFile) { "# endfile comment"); } +TEST_F(FormatTestTextProto, KeepsAmpersandsNextToKeys) { + verifyFormat("@tmpl { field: 1 }"); + verifyFormat("@placeholder: 1"); + verifyFormat("@name <>"); + verifyFormat("submessage: @base { key: value }"); + verifyFormat("submessage: @base {\n" + " key: value\n" + " item: {}\n" + "}"); + verifyFormat("submessage: {\n" + " msg: @base {\n" + " yolo: {}\n" + " key: value\n" + " }\n" + " key: value\n" + "}"); +} + } // end namespace tooling } // end namespace clang |