diff options
Diffstat (limited to 'googletest/test/googletest-filepath-test.cc')
-rw-r--r-- | googletest/test/googletest-filepath-test.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/googletest/test/googletest-filepath-test.cc b/googletest/test/googletest-filepath-test.cc index fe53f84..1e2cc4a 100644 --- a/googletest/test/googletest-filepath-test.cc +++ b/googletest/test/googletest-filepath-test.cc @@ -421,8 +421,13 @@ TEST(NormalizeTest, MultipleConsecutiveSeparatorsInMidstring) { // "/bar" == //bar" == "///bar" TEST(NormalizeTest, MultipleConsecutiveSeparatorsAtStringStart) { EXPECT_EQ(GTEST_PATH_SEP_ "bar", FilePath(GTEST_PATH_SEP_ "bar").string()); +#if GTEST_OS_WINDOWS + EXPECT_EQ(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar", + FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string()); +#else EXPECT_EQ(GTEST_PATH_SEP_ "bar", FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string()); +#endif EXPECT_EQ( GTEST_PATH_SEP_ "bar", FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string()); @@ -621,6 +626,9 @@ TEST(FilePathTest, IsAbsolutePath) { EXPECT_TRUE( FilePath("c:/" GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative") .IsAbsolutePath()); + EXPECT_TRUE(FilePath("d:/Windows").IsAbsolutePath()); + EXPECT_TRUE(FilePath("\\\\Host\\Share").IsAbsolutePath()); + EXPECT_TRUE(FilePath("\\\\Host\\Share\\Folder").IsAbsolutePath()); #else EXPECT_TRUE(FilePath(GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative") .IsAbsolutePath()); @@ -637,6 +645,16 @@ TEST(FilePathTest, IsRootDirectory) { EXPECT_FALSE(FilePath("b:a").IsRootDirectory()); EXPECT_FALSE(FilePath("8:/").IsRootDirectory()); EXPECT_FALSE(FilePath("c|/").IsRootDirectory()); + EXPECT_TRUE(FilePath("c:/").IsRootDirectory()); + EXPECT_FALSE(FilePath("d:/Windows").IsRootDirectory()); + + // This is for backward compatibility, since callers (even in this library) + // have assumed IsRootDirectory() implies a trailing directory separator. + EXPECT_FALSE(FilePath("\\\\Host\\Share").IsRootDirectory()); + + EXPECT_TRUE(FilePath("\\\\Host\\Share\\").IsRootDirectory()); + EXPECT_FALSE(FilePath("\\\\Host\\Share\\.").IsRootDirectory()); + EXPECT_FALSE(FilePath("\\\\Host\\Share\\C$\\").IsRootDirectory()); #else EXPECT_TRUE(FilePath("/").IsRootDirectory()); EXPECT_TRUE(FilePath("//").IsRootDirectory()); |