Comment parsing: fix a bug where a line with whitespace between two paragraphs
would cause us to concatenate these paragraphs into a single one.
The no-op whitespace churn in test/Index test happened because these tests
don't use the correct approach for testing and are more strict than required
for they are testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189126 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/AST/CommentParser.cpp b/unittests/AST/CommentParser.cpp
index d05fb58..f75c636 100644
--- a/unittests/AST/CommentParser.cpp
+++ b/unittests/AST/CommentParser.cpp
@@ -628,18 +628,43 @@
}
}
-TEST_F(CommentParserTest, Paragraph1) {
+TEST_F(CommentParserTest, ParagraphSplitting1) {
const char *Sources[] = {
"// Aaa\n"
"//\n"
"// Bbb",
"// Aaa\n"
+ "// \n"
+ "// Bbb",
+
+ "// Aaa\n"
+ "//\t\n"
+ "// Bbb",
+
+ "// Aaa\n"
"//\n"
"//\n"
"// Bbb",
- };
+ "/**\n"
+ " Aaa\n"
+ "\n"
+ " Bbb\n"
+ "*/",
+
+ "/**\n"
+ " Aaa\n"
+ " \n"
+ " Bbb\n"
+ "*/",
+
+ "/**\n"
+ " Aaa\n"
+ "\t \n"
+ " Bbb\n"
+ "*/",
+ };
for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
@@ -650,7 +675,7 @@
}
}
-TEST_F(CommentParserTest, Paragraph2) {
+TEST_F(CommentParserTest, Paragraph1) {
const char *Source =
"// \\brief Aaa\n"
"//\n"
@@ -670,7 +695,7 @@
ASSERT_TRUE(HasParagraphCommentAt(FC, 2, " Bbb"));
}
-TEST_F(CommentParserTest, Paragraph3) {
+TEST_F(CommentParserTest, Paragraph2) {
const char *Source = "// \\brief \\author";
FullComment *FC = parseString(Source);
@@ -694,7 +719,7 @@
}
}
-TEST_F(CommentParserTest, Paragraph4) {
+TEST_F(CommentParserTest, Paragraph3) {
const char *Source =
"// \\brief Aaa\n"
"// Bbb \\author\n"