Index: tools/gn/function_rebase_path_unittest.cc |
diff --git a/tools/gn/function_rebase_path_unittest.cc b/tools/gn/function_rebase_path_unittest.cc |
index 0537d10d50aa296144c8ebf721b861e32ef906dc..0bf1811a273dcb3b29a0057185e766932dacdcfc 100644 |
--- a/tools/gn/function_rebase_path_unittest.cc |
+++ b/tools/gn/function_rebase_path_unittest.cc |
@@ -78,6 +78,33 @@ TEST(RebasePath, Strings) { |
#endif |
} |
+TEST(RebasePath, StringsSystemPaths) { |
+ TestWithScope setup; |
+ Scope* scope = setup.scope(); |
+ setup.build_settings()->SetBuildDir(SourceDir("/ssd/out/Debug")); |
+ setup.build_settings()->SetRootPath(base::FilePath("/hdd/src")); |
+ |
+ // Test system absolute to-dir. |
+ EXPECT_EQ("../../ssd/out/Debug", |
+ RebaseOne(scope, ".", "//", "/ssd/out/Debug")); |
+ EXPECT_EQ("../../ssd/out/Debug/", |
+ RebaseOne(scope, "./", "//", "/ssd/out/Debug")); |
+ EXPECT_EQ("../../ssd/out/Debug/foo", |
+ RebaseOne(scope, "foo", "//", "/ssd/out/Debug")); |
+ EXPECT_EQ("../../ssd/out/Debug/foo/", |
+ RebaseOne(scope, "foo/", "//", "/ssd/out/Debug")); |
+ |
+ // Test system absolute from-dir. |
+ EXPECT_EQ("../../../hdd/src", |
+ RebaseOne(scope, ".", "/ssd/out/Debug", "//")); |
+ EXPECT_EQ("../../../hdd/src/", |
+ RebaseOne(scope, "./", "/ssd/out/Debug", "//")); |
+ EXPECT_EQ("../../../hdd/src/foo", |
+ RebaseOne(scope, "foo", "/ssd/out/Debug", "//")); |
+ EXPECT_EQ("../../../hdd/src/foo/", |
+ RebaseOne(scope, "foo/", "/ssd/out/Debug", "//")); |
+} |
+ |
// Test list input. |
TEST(RebasePath, List) { |
TestWithScope setup; |