Simplifies implementation by defining a POSIX portability layer; adds the death test style flag to --help.

This commit is contained in:
zhanyong.wan
2009-03-26 19:03:47 +00:00
parent f3c6efd8d7
commit 3c7bbf5b46
12 changed files with 184 additions and 268 deletions

View File

@@ -60,8 +60,9 @@
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
using testing::Message;
namespace posix = ::testing::internal::posix;
using testing::Message;
using testing::internal::DeathTest;
using testing::internal::DeathTestFactory;
using testing::internal::FilePath;
@@ -105,11 +106,7 @@ class TestForDeathTest : public testing::Test {
TestForDeathTest() : original_dir_(FilePath::GetCurrentDir()) {}
virtual ~TestForDeathTest() {
#if GTEST_OS_WINDOWS
_chdir(original_dir_.c_str());
#else
chdir(original_dir_.c_str());
#endif
posix::chdir(original_dir_.c_str());
}
// A static member function that's expected to die.
@@ -348,13 +345,7 @@ TEST_F(TestForDeathTest, MemberFunctionFastStyle) {
EXPECT_DEATH(MemberFunction(), "inside.*MemberFunction");
}
void ChangeToRootDir() {
#if GTEST_OS_WINDOWS
_chdir("\\");
#else
chdir("/");
#endif // GTEST_OS_WINDOWS
}
void ChangeToRootDir() { posix::chdir(GTEST_PATH_SEP_); }
// Tests that death tests work even if the current directory has been
// changed.