aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-11-12 17:50:13 +0000
committerAlexander Kornienko <alexfh@google.com>2013-11-12 17:50:13 +0000
commit875395f9f88aec48006f39aa02e1226208300230 (patch)
tree77237d1a30c83d7815cc240a1c9bef81fc5e9c09 /clang/unittests
parent3f902b27880014413596402f9d9b927054684be1 (diff)
downloadllvm-875395f9f88aec48006f39aa02e1226208300230.zip
llvm-875395f9f88aec48006f39aa02e1226208300230.tar.gz
llvm-875395f9f88aec48006f39aa02e1226208300230.tar.bz2
Remove extra whitespace instead of breaking the line in comments when possible.
Summary: Solves the problem described in http://llvm.org/PR17756 Reviewers: klimek Reviewed By: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2131 llvm-svn: 194493
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Format/FormatTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 9f05619..f2ac3ba 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -985,6 +985,11 @@ TEST_F(FormatTest, SplitsLongCxxComments) {
format("//Even if it makes the line exceed the column limit",
getLLVMStyleWithColumns(51)));
EXPECT_EQ("//--But not here", format("//--But not here", getLLVMStyle()));
+
+ EXPECT_EQ("// aa bb cc dd",
+ format("// aa bb cc dd ",
+ getLLVMStyleWithColumns(15)));
+
EXPECT_EQ("// A comment before\n"
"// a macro\n"
"// definition\n"
@@ -1252,6 +1257,17 @@ TEST_F(FormatTest, SplitsLongLinesInComments) {
" \n"
" \n"
" */\n"));
+
+ EXPECT_EQ("/* a a */",
+ format("/* a a */", getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("/* a a bc */",
+ format("/* a a bc */", getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("/* aaa aaa\n"
+ " * aaaaa */",
+ format("/* aaa aaa aaaaa */", getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("/* aaa aaa\n"
+ " * aaaaa */",
+ format("/* aaa aaa aaaaa */", getLLVMStyleWithColumns(15)));
}
TEST_F(FormatTest, SplitsLongLinesInCommentsInPreprocessor) {