summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestSelective.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2017-01-25 13:58:58 +0000
committerKrasimir Georgiev <krasimir@google.com>2017-01-25 13:58:58 +0000
commit91834227a3d58ecdb9e3f7300f587ab45c32ba06 (patch)
treeea69dbb58f44ddcc2ed095c59818658998aa5681 /clang/unittests/Format/FormatTestSelective.cpp
parentf242ffa09581e22dfd3207223ca4e4d3e9327bff (diff)
downloadbcm5719-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.cpp10
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",
OpenPOWER on IntegriCloud