diff options
author | Krasimir Georgiev <krasimir@google.com> | 2017-01-25 13:58:58 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2017-01-25 13:58:58 +0000 |
commit | 91834227a3d58ecdb9e3f7300f587ab45c32ba06 (patch) | |
tree | ea69dbb58f44ddcc2ed095c59818658998aa5681 /clang/unittests/Format/FormatTestSelective.cpp | |
parent | f242ffa09581e22dfd3207223ca4e4d3e9327bff (diff) | |
download | bcm5719-llvm-91834227a3d58ecdb9e3f7300f587ab45c32ba06.tar.gz bcm5719-llvm-91834227a3d58ecdb9e3f7300f587ab45c32ba06.zip |
[clang-format] Implement comment reflowing.
Summary:
This presents a version of the comment reflowing with less mutable state inside
the comment breakable token subclasses. The state has been pushed into the
driving breakProtrudingToken method. For this, the API of BreakableToken is enriched
by the methods getSplitBefore and getLineLengthAfterSplitBefore.
Reviewers: klimek
Reviewed By: klimek
Subscribers: djasper, klimek, mgorny, cfe-commits, ioeric
Differential Revision: https://reviews.llvm.org/D28764
llvm-svn: 293055
Diffstat (limited to 'clang/unittests/Format/FormatTestSelective.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestSelective.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/unittests/Format/FormatTestSelective.cpp b/clang/unittests/Format/FormatTestSelective.cpp index 2bc60fd1e0d..367dbafcaf4 100644 --- a/clang/unittests/Format/FormatTestSelective.cpp +++ b/clang/unittests/Format/FormatTestSelective.cpp @@ -111,13 +111,19 @@ TEST_F(FormatTestSelective, FormatsCommentsLocally) { format("int a; // comment\n" "int b; // comment", 0, 0)); - EXPECT_EQ("int a; // comment\n" - " // line 2\n" + EXPECT_EQ("int a; // comment\n" + " // line 2\n" "int b;", format("int a; // comment\n" " // line 2\n" "int b;", 28, 0)); + EXPECT_EQ("int a; // comment\n" + "// comment 2\n" + "int b;", + format("int a; // comment\n" + "// comment 2\n" + "int b;", 28, 0)); EXPECT_EQ("int aaaaaa; // comment\n" "int b;\n" "int c; // unrelated comment", |