Index: tools/gn/filesystem_utils_unittest.cc |
diff --git a/tools/gn/filesystem_utils_unittest.cc b/tools/gn/filesystem_utils_unittest.cc |
index 3416e1659fca2e637f75b8339d1f390223d641b7..ec1a53e7633d04d11d67f9c662a403af830dadac 100644 |
--- a/tools/gn/filesystem_utils_unittest.cc |
+++ b/tools/gn/filesystem_utils_unittest.cc |
@@ -73,6 +73,23 @@ TEST(FilesystemUtils, FindDir) { |
EXPECT_EQ("foo/bar/", FindDir(&input)); |
} |
+TEST(FilesystemUtils, FindLastDirComponent) { |
+ SourceDir empty; |
+ EXPECT_EQ("", FindLastDirComponent(empty)); |
+ |
+ SourceDir root("/"); |
+ EXPECT_EQ("", FindLastDirComponent(root)); |
+ |
+ SourceDir srcroot("//"); |
+ EXPECT_EQ("", FindLastDirComponent(srcroot)); |
+ |
+ SourceDir regular1("//foo/"); |
+ EXPECT_EQ("foo", FindLastDirComponent(regular1)); |
+ |
+ SourceDir regular2("//foo/bar/"); |
+ EXPECT_EQ("bar", FindLastDirComponent(regular2)); |
+} |
+ |
TEST(FilesystemUtils, IsPathAbsolute) { |
EXPECT_TRUE(IsPathAbsolute("/foo/bar")); |
EXPECT_TRUE(IsPathAbsolute("/")); |