aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest-filepath_test.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-03-11 22:18:52 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-03-11 22:18:52 +0000
commit87d23e45f096c91c9e722b20bf15b733dbab0f80 (patch)
tree371303a68075a9188a758ad359689fc579ff8388 /test/gtest-filepath_test.cc
parent3d8064999c838978bd271fcf78185f4e6f042f12 (diff)
downloadgoogletest-87d23e45f096c91c9e722b20bf15b733dbab0f80.tar.gz
googletest-87d23e45f096c91c9e722b20bf15b733dbab0f80.tar.bz2
googletest-87d23e45f096c91c9e722b20bf15b733dbab0f80.zip
Implements the --help flag; fixes tests on Windows.
Diffstat (limited to 'test/gtest-filepath_test.cc')
-rw-r--r--test/gtest-filepath_test.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/gtest-filepath_test.cc b/test/gtest-filepath_test.cc
index dfbd5f02..f8b68a78 100644
--- a/test/gtest-filepath_test.cc
+++ b/test/gtest-filepath_test.cc
@@ -50,16 +50,11 @@
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
-#if GTEST_OS_WINDOWS
#ifdef _WIN32_WCE
#include <windows.h> // NOLINT
-#else
+#elif GTEST_OS_WINDOWS
#include <direct.h> // NOLINT
#endif // _WIN32_WCE
-#define GTEST_PATH_SEP_ "\\"
-#else
-#define GTEST_PATH_SEP_ "/"
-#endif // GTEST_OS_WINDOWS
namespace testing {
namespace internal {
@@ -88,11 +83,13 @@ int _rmdir(const char* path) {
#ifndef _WIN32_WCE
TEST(GetCurrentDirTest, ReturnsCurrentDir) {
- EXPECT_FALSE(FilePath::GetCurrentDir().IsEmpty());
+ const FilePath original_dir = FilePath::GetCurrentDir();
+ EXPECT_FALSE(original_dir.IsEmpty());
#if GTEST_OS_WINDOWS
_chdir(GTEST_PATH_SEP_);
const FilePath cwd = FilePath::GetCurrentDir();
+ _chdir(original_dir.c_str());
// Skips the ":".
const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
ASSERT_TRUE(cwd_without_drive != NULL);
@@ -100,6 +97,7 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) {
#else
chdir(GTEST_PATH_SEP_);
EXPECT_STREQ(GTEST_PATH_SEP_, FilePath::GetCurrentDir().c_str());
+ chdir(original_dir.c_str());
#endif
}