aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest-filepath_test.cc
diff options
context:
space:
mode:
authorvladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2010-02-03 02:27:02 +0000
committervladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2010-02-03 02:27:02 +0000
commitcfcbc298cd91806e0e3417e03fce42bc4f1fa150 (patch)
treeaf456a0d47524f6bb5cbb49d160e0aaf60110daf /test/gtest-filepath_test.cc
parent8d373310561a8d68d2a22ca7c6613deff5fa6e05 (diff)
downloadgoogletest-cfcbc298cd91806e0e3417e03fce42bc4f1fa150.tar.gz
googletest-cfcbc298cd91806e0e3417e03fce42bc4f1fa150.tar.bz2
googletest-cfcbc298cd91806e0e3417e03fce42bc4f1fa150.zip
Adds Solaris support (by Hady Zalek)
Diffstat (limited to 'test/gtest-filepath_test.cc')
-rw-r--r--test/gtest-filepath_test.cc51
1 files changed, 26 insertions, 25 deletions
diff --git a/test/gtest-filepath_test.cc b/test/gtest-filepath_test.cc
index 5706c8e1..c5f58f42 100644
--- a/test/gtest-filepath_test.cc
+++ b/test/gtest-filepath_test.cc
@@ -153,31 +153,31 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
#if GTEST_HAS_ALT_PATH_SEP_
-// Test RemoveDirectory* functions with "/".
+// Tests that RemoveDirectoryName() works with the alternate separator
+// on Windows.
-// RemoveDirectoryName "/afile" -> "afile"
+// RemoveDirectoryName("/afile") -> "afile"
TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileNameForAlternateSeparator) {
EXPECT_STREQ("afile",
- FilePath("/afile").RemoveDirectoryName().c_str());
+ FilePath("/afile").RemoveDirectoryName().c_str());
}
-// RemoveDirectoryName "adir/" -> ""
+// RemoveDirectoryName("adir/") -> ""
TEST(RemoveDirectoryNameTest, WhereThereIsNoFileNameForAlternateSeparator) {
EXPECT_STREQ("",
- FilePath("adir/").RemoveDirectoryName().c_str());
+ FilePath("adir/").RemoveDirectoryName().c_str());
}
-// RemoveDirectoryName "adir/afile" -> "afile"
+// RemoveDirectoryName("adir/afile") -> "afile"
TEST(RemoveDirectoryNameTest, ShouldGiveFileNameForAlternateSeparator) {
EXPECT_STREQ("afile",
- FilePath("adir/afile").RemoveDirectoryName().c_str());
+ FilePath("adir/afile").RemoveDirectoryName().c_str());
}
-// RemoveDirectoryName "adir/subdir/afile" -> "afile"
+// RemoveDirectoryName("adir/subdir/afile") -> "afile"
TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) {
EXPECT_STREQ("afile",
- FilePath("adir/subdir/afile")
- .RemoveDirectoryName().c_str());
+ FilePath("adir/subdir/afile").RemoveDirectoryName().c_str());
}
#endif
@@ -222,32 +222,31 @@ TEST(RemoveFileNameTest, GivesRootDir) {
#if GTEST_HAS_ALT_PATH_SEP_
-// Test RemoveFile* functions with "/".
+// Tests that RemoveFileName() works with the alternate separator on
+// Windows.
-// RemoveFileName "adir/" -> "adir/"
+// RemoveFileName("adir/") -> "adir/"
TEST(RemoveFileNameTest, ButNoFileForAlternateSeparator) {
EXPECT_STREQ("adir" GTEST_PATH_SEP_,
- FilePath("adir/").RemoveFileName().c_str());
+ FilePath("adir/").RemoveFileName().c_str());
}
-// RemoveFileName "adir/afile" -> "adir/"
+// RemoveFileName("adir/afile") -> "adir/"
TEST(RemoveFileNameTest, GivesDirNameForAlternateSeparator) {
EXPECT_STREQ("adir" GTEST_PATH_SEP_,
- FilePath("adir/afile")
- .RemoveFileName().c_str());
+ FilePath("adir/afile").RemoveFileName().c_str());
}
-// RemoveFileName "adir/subdir/afile" -> "adir/subdir/"
+// RemoveFileName("adir/subdir/afile") -> "adir/subdir/"
TEST(RemoveFileNameTest, GivesDirAndSubDirNameForAlternateSeparator) {
EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
- FilePath("adir/subdir/afile")
- .RemoveFileName().c_str());
+ FilePath("adir/subdir/afile").RemoveFileName().c_str());
}
-// RemoveFileName "/afile" -> "\"
+// RemoveFileName("/afile") -> "\"
TEST(RemoveFileNameTest, GivesRootDirForAlternateSeparator) {
EXPECT_STREQ(GTEST_PATH_SEP_,
- FilePath("/afile").RemoveFileName().c_str());
+ FilePath("/afile").RemoveFileName().c_str());
}
#endif
@@ -357,9 +356,8 @@ TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) {
"foo",
FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().c_str());
#if GTEST_HAS_ALT_PATH_SEP_
- EXPECT_STREQ(
- "foo",
- FilePath("foo/").RemoveTrailingPathSeparator().c_str());
+ EXPECT_STREQ("foo",
+ FilePath("foo/").RemoveTrailingPathSeparator().c_str());
#endif
}
@@ -465,7 +463,9 @@ TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {
#if GTEST_HAS_ALT_PATH_SEP_
-// "foo\" =="foo/\" == "foo\\/"
+// Tests that separators at the end of the string are normalized
+// regardless of their combination (e.g. "foo\" =="foo/\" ==
+// "foo\\/").
TEST(NormalizeTest, MixAlternateSeparatorAtStringEnd) {
EXPECT_STREQ("foo" GTEST_PATH_SEP_,
FilePath("foo/").c_str());
@@ -678,6 +678,7 @@ TEST(FilePathTest, IsRootDirectory) {
EXPECT_FALSE(FilePath("c|/").IsRootDirectory());
#else
EXPECT_TRUE(FilePath("/").IsRootDirectory());
+ EXPECT_TRUE(FilePath("//").IsRootDirectory());
EXPECT_FALSE(FilePath("").IsRootDirectory());
EXPECT_FALSE(FilePath("\\").IsRootDirectory());
EXPECT_FALSE(FilePath("/x").IsRootDirectory());