Index: tools/gn/c_include_iterator_unittest.cc |
diff --git a/tools/gn/c_include_iterator_unittest.cc b/tools/gn/c_include_iterator_unittest.cc |
index 11fa9917c4e6848c7521aecf387a70f6f4d65595..1add29b53aab8541408aa848968c51c3d973814f 100644 |
--- a/tools/gn/c_include_iterator_unittest.cc |
+++ b/tools/gn/c_include_iterator_unittest.cc |
@@ -132,3 +132,26 @@ TEST(CIncludeIterator, TolerateNonIncludes) { |
} |
EXPECT_FALSE(iter.GetNextIncludeString(&contents, &range)); |
} |
+ |
+// Tests that comments of the form |
+// /* |
+// * |
+// */ |
+// are not counted toward the non-include line count. |
+TEST(CIncludeIterator, CStyleComments) { |
+ std::string buffer("/*"); |
+ for (size_t i = 0; i < 1000; i++) |
+ buffer.append(" *\n"); |
+ buffer.append(" */\n\n"); |
+ buffer.append("#include \"foo/bar.h\"\n"); |
+ |
+ InputFile file(SourceFile("//foo.cc")); |
+ file.SetContents(buffer); |
+ |
+ base::StringPiece contents; |
+ LocationRange range; |
+ |
+ CIncludeIterator iter(&file); |
+ EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); |
+ EXPECT_EQ("foo/bar.h", contents); |
+} |