Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: tools/gn/c_include_iterator_unittest.cc

Issue 1411573002: Handle Mozilla license blocks in the GN header checker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/c_include_iterator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « tools/gn/c_include_iterator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698