diff options
Diffstat (limited to 'gn/tools/gn/c_include_iterator_unittest.cc')
-rw-r--r-- | gn/tools/gn/c_include_iterator_unittest.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gn/tools/gn/c_include_iterator_unittest.cc b/gn/tools/gn/c_include_iterator_unittest.cc index ef442635390..a88537c9289 100644 --- a/gn/tools/gn/c_include_iterator_unittest.cc +++ b/gn/tools/gn/c_include_iterator_unittest.cc @@ -159,3 +159,20 @@ TEST(CIncludeIterator, CStyleComments) { EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); EXPECT_EQ("foo/bar.h", contents); } + +// Tests that spaces between the hash and directive are ignored. +TEST(CIncludeIterator, SpacesAfterHash) { + std::string buffer("# 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); + + EXPECT_FALSE(iter.GetNextIncludeString(&contents, &range)); +} |