Publishes the even listener API (by Vlad Losev); adds OS-indicating macros to simplify gtest code (by Zhanyong Wan).
This commit is contained in:
@@ -50,17 +50,17 @@
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
#include <windows.h> // NOLINT
|
||||
#elif GTEST_OS_WINDOWS
|
||||
#include <direct.h> // NOLINT
|
||||
#endif // _WIN32_WCE
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
namespace {
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
// TODO(wan@google.com): Move these to the POSIX adapter section in
|
||||
// gtest-port.h.
|
||||
|
||||
@@ -81,9 +81,7 @@ int _rmdir(const char* path) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // _WIN32_WCE
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#else
|
||||
|
||||
TEST(GetCurrentDirTest, ReturnsCurrentDir) {
|
||||
const FilePath original_dir = FilePath::GetCurrentDir();
|
||||
@@ -103,7 +101,7 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _WIN32_WCE
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
TEST(IsEmptyTest, ReturnsTrueForEmptyPath) {
|
||||
EXPECT_TRUE(FilePath("").IsEmpty());
|
||||
@@ -156,7 +154,7 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
|
||||
|
||||
// RemoveFileName "" -> "./"
|
||||
TEST(RemoveFileNameTest, EmptyName) {
|
||||
#ifdef _WIN32_WCE
|
||||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
// On Windows CE, we use the root as the current directory.
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_,
|
||||
FilePath("").RemoveFileName().c_str());
|
||||
@@ -344,12 +342,12 @@ TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
|
||||
}
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#if !GTEST_OS_WINDOWS_MOBILE
|
||||
// Windows CE _does_ consider an empty directory to exist.
|
||||
TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
|
||||
EXPECT_FALSE(FilePath("").DirectoryExists());
|
||||
}
|
||||
#endif // ! _WIN32_WCE
|
||||
#endif // !GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
TEST(DirectoryTest, CurrentDirectoryExists) {
|
||||
#if GTEST_OS_WINDOWS // We are on Windows.
|
||||
@@ -449,9 +447,8 @@ class DirectoryCreationTest : public Test {
|
||||
}
|
||||
|
||||
String TempDir() const {
|
||||
#ifdef _WIN32_WCE
|
||||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
return String("\\temp\\");
|
||||
|
||||
#elif GTEST_OS_WINDOWS
|
||||
const char* temp_dir = posix::GetEnv("TEMP");
|
||||
if (temp_dir == NULL || temp_dir[0] == '\0')
|
||||
@@ -462,7 +459,7 @@ class DirectoryCreationTest : public Test {
|
||||
return String::Format("%s\\", temp_dir);
|
||||
#else
|
||||
return String("/tmp/");
|
||||
#endif
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
}
|
||||
|
||||
void CreateTextFile(const char* filename) {
|
||||
|
||||
Reference in New Issue
Block a user