Cleans up macro definitions.
This commit is contained in:
@@ -46,19 +46,19 @@
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef _WIN32_WCE
|
||||
#include <windows.h> // NOLINT
|
||||
#else
|
||||
#include <direct.h> // NOLINT
|
||||
#endif // _WIN32_WCE
|
||||
#define PATH_SEP "\\"
|
||||
#define GTEST_PATH_SEP_ "\\"
|
||||
#else
|
||||
#define PATH_SEP "/"
|
||||
#define GTEST_PATH_SEP_ "/"
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
namespace testing {
|
||||
@@ -90,16 +90,16 @@ int _rmdir(const char* path) {
|
||||
TEST(GetCurrentDirTest, ReturnsCurrentDir) {
|
||||
EXPECT_FALSE(FilePath::GetCurrentDir().IsEmpty());
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
_chdir(PATH_SEP);
|
||||
#if GTEST_OS_WINDOWS
|
||||
_chdir(GTEST_PATH_SEP_);
|
||||
const FilePath cwd = FilePath::GetCurrentDir();
|
||||
// Skips the ":".
|
||||
const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
|
||||
ASSERT_TRUE(cwd_without_drive != NULL);
|
||||
EXPECT_STREQ(PATH_SEP, cwd_without_drive + 1);
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_, cwd_without_drive + 1);
|
||||
#else
|
||||
chdir(PATH_SEP);
|
||||
EXPECT_STREQ(PATH_SEP, FilePath::GetCurrentDir().c_str());
|
||||
chdir(GTEST_PATH_SEP_);
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_, FilePath::GetCurrentDir().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -131,25 +131,25 @@ TEST(RemoveDirectoryNameTest, ButNoDirectory) {
|
||||
// RemoveDirectoryName "/afile" -> "afile"
|
||||
TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileName) {
|
||||
EXPECT_STREQ("afile",
|
||||
FilePath(PATH_SEP "afile").RemoveDirectoryName().c_str());
|
||||
FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
|
||||
}
|
||||
|
||||
// RemoveDirectoryName "adir/" -> ""
|
||||
TEST(RemoveDirectoryNameTest, WhereThereIsNoFileName) {
|
||||
EXPECT_STREQ("",
|
||||
FilePath("adir" PATH_SEP).RemoveDirectoryName().c_str());
|
||||
FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().c_str());
|
||||
}
|
||||
|
||||
// RemoveDirectoryName "adir/afile" -> "afile"
|
||||
TEST(RemoveDirectoryNameTest, ShouldGiveFileName) {
|
||||
EXPECT_STREQ("afile",
|
||||
FilePath("adir" PATH_SEP "afile").RemoveDirectoryName().c_str());
|
||||
FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
|
||||
}
|
||||
|
||||
// RemoveDirectoryName "adir/subdir/afile" -> "afile"
|
||||
TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
|
||||
EXPECT_STREQ("afile",
|
||||
FilePath("adir" PATH_SEP "subdir" PATH_SEP "afile")
|
||||
FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
|
||||
.RemoveDirectoryName().c_str());
|
||||
}
|
||||
|
||||
@@ -158,63 +158,63 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
|
||||
TEST(RemoveFileNameTest, EmptyName) {
|
||||
#ifdef _WIN32_WCE
|
||||
// On Windows CE, we use the root as the current directory.
|
||||
EXPECT_STREQ(PATH_SEP,
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_,
|
||||
FilePath("").RemoveFileName().c_str());
|
||||
#else
|
||||
EXPECT_STREQ("." PATH_SEP,
|
||||
EXPECT_STREQ("." GTEST_PATH_SEP_,
|
||||
FilePath("").RemoveFileName().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
// RemoveFileName "adir/" -> "adir/"
|
||||
TEST(RemoveFileNameTest, ButNoFile) {
|
||||
EXPECT_STREQ("adir" PATH_SEP,
|
||||
FilePath("adir" PATH_SEP).RemoveFileName().c_str());
|
||||
EXPECT_STREQ("adir" GTEST_PATH_SEP_,
|
||||
FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().c_str());
|
||||
}
|
||||
|
||||
// RemoveFileName "adir/afile" -> "adir/"
|
||||
TEST(RemoveFileNameTest, GivesDirName) {
|
||||
EXPECT_STREQ("adir" PATH_SEP,
|
||||
FilePath("adir" PATH_SEP "afile")
|
||||
EXPECT_STREQ("adir" GTEST_PATH_SEP_,
|
||||
FilePath("adir" GTEST_PATH_SEP_ "afile")
|
||||
.RemoveFileName().c_str());
|
||||
}
|
||||
|
||||
// RemoveFileName "adir/subdir/afile" -> "adir/subdir/"
|
||||
TEST(RemoveFileNameTest, GivesDirAndSubDirName) {
|
||||
EXPECT_STREQ("adir" PATH_SEP "subdir" PATH_SEP,
|
||||
FilePath("adir" PATH_SEP "subdir" PATH_SEP "afile")
|
||||
EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
|
||||
FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
|
||||
.RemoveFileName().c_str());
|
||||
}
|
||||
|
||||
// RemoveFileName "/afile" -> "/"
|
||||
TEST(RemoveFileNameTest, GivesRootDir) {
|
||||
EXPECT_STREQ(PATH_SEP,
|
||||
FilePath(PATH_SEP "afile").RemoveFileName().c_str());
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_,
|
||||
FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().c_str());
|
||||
}
|
||||
|
||||
|
||||
TEST(MakeFileNameTest, GenerateWhenNumberIsZero) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
|
||||
0, "xml");
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateFileNameNumberGtZero) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
|
||||
12, "xml");
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar_12.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberIsZero) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo" PATH_SEP),
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
|
||||
FilePath("bar"), 0, "xml");
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberGtZero) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo" PATH_SEP),
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
|
||||
FilePath("bar"), 12, "xml");
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar_12.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateWhenNumberIsZeroAndDirIsEmpty) {
|
||||
@@ -232,13 +232,13 @@ TEST(MakeFileNameTest, GenerateWhenNumberIsNotZeroAndDirIsEmpty) {
|
||||
TEST(ConcatPathsTest, WorksWhenDirDoesNotEndWithPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
|
||||
FilePath("bar.xml"));
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, WorksWhenPath1EndsWithPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo" PATH_SEP),
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_),
|
||||
FilePath("bar.xml"));
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path1BeingEmpty) {
|
||||
@@ -250,7 +250,7 @@ TEST(ConcatPathsTest, Path1BeingEmpty) {
|
||||
TEST(ConcatPathsTest, Path2BeingEmpty) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
|
||||
FilePath(""));
|
||||
EXPECT_STREQ("foo" PATH_SEP, actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_, actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, BothPathBeingEmpty) {
|
||||
@@ -260,21 +260,24 @@ TEST(ConcatPathsTest, BothPathBeingEmpty) {
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path1ContainsPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo" PATH_SEP "bar"),
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_ "bar"),
|
||||
FilePath("foobar.xml"));
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar" PATH_SEP "foobar.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "foobar.xml",
|
||||
actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path2ContainsPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo" PATH_SEP),
|
||||
FilePath("bar" PATH_SEP "bar.xml"));
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar" PATH_SEP "bar.xml", actual.c_str());
|
||||
FilePath actual = FilePath::ConcatPaths(
|
||||
FilePath("foo" GTEST_PATH_SEP_),
|
||||
FilePath("bar" GTEST_PATH_SEP_ "bar.xml"));
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "bar.xml",
|
||||
actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path2EndsWithPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
|
||||
FilePath("bar" PATH_SEP));
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar" PATH_SEP, actual.c_str());
|
||||
FilePath("bar" GTEST_PATH_SEP_));
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_, actual.c_str());
|
||||
}
|
||||
|
||||
// RemoveTrailingPathSeparator "" -> ""
|
||||
@@ -291,25 +294,27 @@ TEST(RemoveTrailingPathSeparatorTest, FileNoSlashString) {
|
||||
|
||||
// RemoveTrailingPathSeparator "foo/" -> "foo"
|
||||
TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) {
|
||||
EXPECT_STREQ("foo",
|
||||
FilePath("foo" PATH_SEP).RemoveTrailingPathSeparator().c_str());
|
||||
EXPECT_STREQ(
|
||||
"foo",
|
||||
FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().c_str());
|
||||
}
|
||||
|
||||
// RemoveTrailingPathSeparator "foo/bar/" -> "foo/bar/"
|
||||
TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveLastSeparator) {
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP "bar" PATH_SEP).RemoveTrailingPathSeparator()
|
||||
.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_)
|
||||
.RemoveTrailingPathSeparator().c_str());
|
||||
}
|
||||
|
||||
// RemoveTrailingPathSeparator "foo/bar" -> "foo/bar"
|
||||
TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) {
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP "bar").RemoveTrailingPathSeparator().c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ "bar")
|
||||
.RemoveTrailingPathSeparator().c_str());
|
||||
}
|
||||
|
||||
TEST(DirectoryTest, RootDirectoryExists) {
|
||||
#ifdef GTEST_OS_WINDOWS // We are on Windows.
|
||||
#if GTEST_OS_WINDOWS // We are on Windows.
|
||||
char current_drive[_MAX_PATH]; // NOLINT
|
||||
current_drive[0] = static_cast<char>(_getdrive() + 'A' - 1);
|
||||
current_drive[1] = ':';
|
||||
@@ -321,7 +326,7 @@ TEST(DirectoryTest, RootDirectoryExists) {
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
}
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
|
||||
const int saved_drive_ = _getdrive();
|
||||
// Find a drive that doesn't exist. Start with 'Z' to avoid common ones.
|
||||
@@ -347,7 +352,7 @@ TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
|
||||
#endif // ! _WIN32_WCE
|
||||
|
||||
TEST(DirectoryTest, CurrentDirectoryExists) {
|
||||
#ifdef GTEST_OS_WINDOWS // We are on Windows.
|
||||
#if GTEST_OS_WINDOWS // We are on Windows.
|
||||
#ifndef _WIN32_CE // Windows CE doesn't have a current directory.
|
||||
EXPECT_TRUE(FilePath(".").DirectoryExists());
|
||||
EXPECT_TRUE(FilePath(".\\").DirectoryExists());
|
||||
@@ -365,32 +370,33 @@ TEST(NormalizeTest, NullStringsEqualEmptyDirectory) {
|
||||
|
||||
// "foo/bar" == foo//bar" == "foo///bar"
|
||||
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsInMidstring) {
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP PATH_SEP PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ "bar").c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_
|
||||
GTEST_PATH_SEP_ "bar").c_str());
|
||||
}
|
||||
|
||||
// "/bar" == //bar" == "///bar"
|
||||
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringStart) {
|
||||
EXPECT_STREQ(PATH_SEP "bar",
|
||||
FilePath(PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ(PATH_SEP "bar",
|
||||
FilePath(PATH_SEP PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ(PATH_SEP "bar",
|
||||
FilePath(PATH_SEP PATH_SEP PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
|
||||
FilePath(GTEST_PATH_SEP_ "bar").c_str());
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
|
||||
FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
|
||||
FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
|
||||
}
|
||||
|
||||
// "foo/" == foo//" == "foo///"
|
||||
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {
|
||||
EXPECT_STREQ("foo" PATH_SEP,
|
||||
FilePath("foo" PATH_SEP).c_str());
|
||||
EXPECT_STREQ("foo" PATH_SEP,
|
||||
FilePath("foo" PATH_SEP PATH_SEP).c_str());
|
||||
EXPECT_STREQ("foo" PATH_SEP,
|
||||
FilePath("foo" PATH_SEP PATH_SEP PATH_SEP).c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_,
|
||||
FilePath("foo" GTEST_PATH_SEP_).c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_,
|
||||
FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_,
|
||||
FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
|
||||
}
|
||||
|
||||
TEST(AssignmentOperatorTest, DefaultAssignedToNonDefault) {
|
||||
@@ -421,7 +427,7 @@ class DirectoryCreationTest : public Test {
|
||||
virtual void SetUp() {
|
||||
testdata_path_.Set(FilePath(String::Format("%s%s%s",
|
||||
TempDir().c_str(), GetCurrentExecutableName().c_str(),
|
||||
"_directory_creation" PATH_SEP "test" PATH_SEP)));
|
||||
"_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_)));
|
||||
testdata_file_.Set(testdata_path_.RemoveTrailingPathSeparator());
|
||||
|
||||
unique_file0_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"),
|
||||
@@ -432,7 +438,7 @@ class DirectoryCreationTest : public Test {
|
||||
remove(testdata_file_.c_str());
|
||||
remove(unique_file0_.c_str());
|
||||
remove(unique_file1_.c_str());
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
_rmdir(testdata_path_.c_str());
|
||||
#else
|
||||
rmdir(testdata_path_.c_str());
|
||||
@@ -443,7 +449,7 @@ class DirectoryCreationTest : public Test {
|
||||
remove(testdata_file_.c_str());
|
||||
remove(unique_file0_.c_str());
|
||||
remove(unique_file1_.c_str());
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
_rmdir(testdata_path_.c_str());
|
||||
#else
|
||||
rmdir(testdata_path_.c_str());
|
||||
@@ -454,7 +460,7 @@ class DirectoryCreationTest : public Test {
|
||||
#ifdef _WIN32_WCE
|
||||
return String("\\temp\\");
|
||||
|
||||
#elif defined(GTEST_OS_WINDOWS)
|
||||
#elif GTEST_OS_WINDOWS
|
||||
// MSVC 8 deprecates getenv(), so we want to suppress warning 4996
|
||||
// (deprecated function) there.
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
@@ -474,7 +480,7 @@ class DirectoryCreationTest : public Test {
|
||||
}
|
||||
|
||||
void CreateTextFile(const char* filename) {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// MSVC 8 deprecates fopen(), so we want to suppress warning 4996
|
||||
// (deprecated function) there.#pragma warning(push)
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
@@ -585,18 +591,18 @@ TEST(FilePathTest, RemoveExtensionWhenThereIsNoExtension) {
|
||||
|
||||
TEST(FilePathTest, IsDirectory) {
|
||||
EXPECT_FALSE(FilePath("cola").IsDirectory());
|
||||
EXPECT_TRUE(FilePath("koala" PATH_SEP).IsDirectory());
|
||||
EXPECT_TRUE(FilePath("koala" GTEST_PATH_SEP_).IsDirectory());
|
||||
}
|
||||
|
||||
TEST(FilePathTest, IsAbsolutePath) {
|
||||
EXPECT_FALSE(FilePath("is" PATH_SEP "relative").IsAbsolutePath());
|
||||
EXPECT_FALSE(FilePath("is" GTEST_PATH_SEP_ "relative").IsAbsolutePath());
|
||||
EXPECT_FALSE(FilePath("").IsAbsolutePath());
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
EXPECT_TRUE(FilePath("c:\\" PATH_SEP "is_not" PATH_SEP "relative")
|
||||
.IsAbsolutePath());
|
||||
EXPECT_FALSE(FilePath("c:foo" PATH_SEP "bar").IsAbsolutePath());
|
||||
#if GTEST_OS_WINDOWS
|
||||
EXPECT_TRUE(FilePath("c:\\" GTEST_PATH_SEP_ "is_not"
|
||||
GTEST_PATH_SEP_ "relative").IsAbsolutePath());
|
||||
EXPECT_FALSE(FilePath("c:foo" GTEST_PATH_SEP_ "bar").IsAbsolutePath());
|
||||
#else
|
||||
EXPECT_TRUE(FilePath(PATH_SEP "is_not" PATH_SEP "relative")
|
||||
EXPECT_TRUE(FilePath(GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative")
|
||||
.IsAbsolutePath());
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
}
|
||||
@@ -605,4 +611,4 @@ TEST(FilePathTest, IsAbsolutePath) {
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
#undef PATH_SEP
|
||||
#undef GTEST_PATH_SEP_
|
||||
|
||||
Reference in New Issue
Block a user