"nndet/vscode:/vscode.git/clone" did not exist on "938687e7f838020e7f0c758057ac46c830521d17"
Commit 0af0709b authored by zhanyong.wan's avatar zhanyong.wan
Browse files

Cleans up macro definitions.

parent 3c7868a9
...@@ -49,7 +49,7 @@ namespace testing { ...@@ -49,7 +49,7 @@ namespace testing {
// after forking. // after forking.
GTEST_DECLARE_string_(death_test_style); GTEST_DECLARE_string_(death_test_style);
#ifdef GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
// The following macros are useful for writing death tests. // The following macros are useful for writing death tests.
......
...@@ -102,7 +102,7 @@ class Message { ...@@ -102,7 +102,7 @@ class Message {
} }
~Message() { delete ss_; } ~Message() { delete ss_; }
#ifdef GTEST_OS_SYMBIAN #if GTEST_OS_SYMBIAN
// Streams a value (either a pointer or not) to this object. // Streams a value (either a pointer or not) to this object.
template <typename T> template <typename T>
inline Message& operator <<(const T& value) { inline Message& operator <<(const T& value) {
...@@ -187,7 +187,7 @@ class Message { ...@@ -187,7 +187,7 @@ class Message {
} }
private: private:
#ifdef GTEST_OS_SYMBIAN #if GTEST_OS_SYMBIAN
// These are needed as the Nokia Symbian Compiler cannot decide between // These are needed as the Nokia Symbian Compiler cannot decide between
// const T& and const T* in a function template. The Nokia compiler _can_ // const T& and const T* in a function template. The Nokia compiler _can_
// decide between class template specializations for T and T*, so a // decide between class template specializations for T and T*, so a
......
...@@ -151,7 +151,7 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); ...@@ -151,7 +151,7 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
#include <gtest/internal/gtest-internal.h> #include <gtest/internal/gtest-internal.h>
#include <gtest/internal/gtest-param-util.h> #include <gtest/internal/gtest-param-util.h>
...@@ -1185,7 +1185,7 @@ inline internal::ParamGenerator<bool> Bool() { ...@@ -1185,7 +1185,7 @@ inline internal::ParamGenerator<bool> Bool() {
return Values(false, true); return Values(false, true);
} }
#ifdef GTEST_HAS_COMBINE #if GTEST_HAS_COMBINE
// Combine() allows the user to combine two or more sequences to produce // Combine() allows the user to combine two or more sequences to produce
// values of a Cartesian product of those sequences' elements. // values of a Cartesian product of those sequences' elements.
// //
......
...@@ -152,7 +152,7 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); ...@@ -152,7 +152,7 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
#include <gtest/internal/gtest-internal.h> #include <gtest/internal/gtest-internal.h>
#include <gtest/internal/gtest-param-util.h> #include <gtest/internal/gtest-param-util.h>
...@@ -344,7 +344,7 @@ inline internal::ParamGenerator<bool> Bool() { ...@@ -344,7 +344,7 @@ inline internal::ParamGenerator<bool> Bool() {
return Values(false, true); return Values(false, true);
} }
#ifdef GTEST_HAS_COMBINE #if GTEST_HAS_COMBINE
// Combine() allows the user to combine two or more sequences to produce // Combine() allows the user to combine two or more sequences to produce
// values of a Cartesian product of those sequences' elements. // values of a Cartesian product of those sequences' elements.
// //
......
...@@ -151,7 +151,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes); ...@@ -151,7 +151,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
// Implements typed tests. // Implements typed tests.
#ifdef GTEST_HAS_TYPED_TEST #if GTEST_HAS_TYPED_TEST
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// //
...@@ -186,7 +186,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes); ...@@ -186,7 +186,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
// Implements type-parameterized tests. // Implements type-parameterized tests.
#ifdef GTEST_HAS_TYPED_TEST_P #if GTEST_HAS_TYPED_TEST_P
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// //
......
...@@ -390,7 +390,7 @@ class TestInfo { ...@@ -390,7 +390,7 @@ class TestInfo {
// Returns the result of the test. // Returns the result of the test.
const internal::TestResult* result() const; const internal::TestResult* result() const;
private: private:
#ifdef GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
friend class internal::DefaultDeathTestFactory; friend class internal::DefaultDeathTestFactory;
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
friend class internal::TestInfoImpl; friend class internal::TestInfoImpl;
...@@ -521,7 +521,7 @@ class UnitTest { ...@@ -521,7 +521,7 @@ class UnitTest {
// or NULL if no test is running. // or NULL if no test is running.
const TestInfo* current_test_info() const; const TestInfo* current_test_info() const;
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
// Returns the ParameterizedTestCaseRegistry object used to keep track of // Returns the ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them. // value-parameterized tests and instantiate and register them.
internal::ParameterizedTestCaseRegistry& parameterized_test_registry(); internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
...@@ -940,7 +940,7 @@ class AssertHelper { ...@@ -940,7 +940,7 @@ class AssertHelper {
} // namespace internal } // namespace internal
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
// The abstract base class that all value-parameterized tests inherit from. // The abstract base class that all value-parameterized tests inherit from.
// //
// This class adds support for accessing the test parameter value via // This class adds support for accessing the test parameter value via
...@@ -1234,7 +1234,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2, ...@@ -1234,7 +1234,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
double val1, double val2); double val1, double val2);
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
// Macros that test for HRESULT failure and success, these are only useful // Macros that test for HRESULT failure and success, these are only useful
// on Windows, and rely on Windows SDK macros and APIs to compile. // on Windows, and rely on Windows SDK macros and APIs to compile.
......
...@@ -49,7 +49,7 @@ const char kDeathTestStyleFlag[] = "death_test_style"; ...@@ -49,7 +49,7 @@ const char kDeathTestStyleFlag[] = "death_test_style";
const char kDeathTestUseFork[] = "death_test_use_fork"; const char kDeathTestUseFork[] = "death_test_use_fork";
const char kInternalRunDeathTestFlag[] = "internal_run_death_test"; const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
#ifdef GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
// DeathTest is a class that hides much of the complexity of the // DeathTest is a class that hides much of the complexity of the
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method // GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#ifdef GTEST_OS_LINUX #if GTEST_OS_LINUX
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
...@@ -546,7 +546,7 @@ class TestFactoryImpl : public TestFactoryBase { ...@@ -546,7 +546,7 @@ class TestFactoryImpl : public TestFactoryBase {
virtual Test* CreateTest() { return new TestClass; } virtual Test* CreateTest() { return new TestClass; }
}; };
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
// Predicate-formatters for implementing the HRESULT checking macros // Predicate-formatters for implementing the HRESULT checking macros
// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED} // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
...@@ -600,7 +600,7 @@ TestInfo* MakeAndRegisterTestInfo( ...@@ -600,7 +600,7 @@ TestInfo* MakeAndRegisterTestInfo(
TearDownTestCaseFunc tear_down_tc, TearDownTestCaseFunc tear_down_tc,
TestFactoryBase* factory); TestFactoryBase* factory);
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P) #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// State of the definition of a type-parameterized test case. // State of the definition of a type-parameterized test case.
class TypedTestCasePState { class TypedTestCasePState {
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
#include <gtest/internal/gtest-param-util.h> #include <gtest/internal/gtest-param-util.h>
...@@ -2659,7 +2659,7 @@ class ValueArray50 { ...@@ -2659,7 +2659,7 @@ class ValueArray50 {
const T50 v50_; const T50 v50_;
}; };
#ifdef GTEST_HAS_COMBINE #if GTEST_HAS_COMBINE
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// //
// Generates values from the Cartesian product of values produced // Generates values from the Cartesian product of values produced
......
...@@ -47,7 +47,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. ...@@ -47,7 +47,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
#include <gtest/internal/gtest-param-util.h> #include <gtest/internal/gtest-param-util.h>
...@@ -92,7 +92,7 @@ $for j [[ ...@@ -92,7 +92,7 @@ $for j [[
]] ]]
#ifdef GTEST_HAS_COMBINE #if GTEST_HAS_COMBINE
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// //
// Generates values from the Cartesian product of values produced // Generates values from the Cartesian product of values produced
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
#if GTEST_HAS_RTTI #if GTEST_HAS_RTTI
#include <typeinfo> #include <typeinfo>
......
...@@ -63,21 +63,15 @@ ...@@ -63,21 +63,15 @@
// This header defines the following utilities: // This header defines the following utilities:
// //
// Macros indicating the name of the Google C++ Testing Framework project: // Macros indicating the current platform (defined to 1 if compiled on
// GTEST_NAME - a string literal of the project name. // the given platform; otherwise undefined):
// GTEST_FLAG_PREFIX - a string literal of the prefix all Google // GTEST_OS_CYGWIN - Cygwin
// Test flag names share. // GTEST_OS_LINUX - Linux
// GTEST_FLAG_PREFIX_UPPER - a string literal of the prefix all Google // GTEST_OS_MAC - Mac OS X
// Test flag names share, in upper case. // GTEST_OS_SOLARIS - Sun Solaris
// // GTEST_OS_SYMBIAN - Symbian
// Macros indicating the current platform: // GTEST_OS_WINDOWS - Windows
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin. // GTEST_OS_ZOS - z/OS
// GTEST_OS_LINUX - defined iff compiled on Linux.
// GTEST_OS_MAC - defined iff compiled on Mac OS X.
// GTEST_OS_SOLARIS - defined iff compiled on Sun Solaris.
// GTEST_OS_SYMBIAN - defined iff compiled for Symbian.
// GTEST_OS_WINDOWS - defined iff compiled on Windows.
// GTEST_OS_ZOS - defined iff compiled on IBM z/OS.
// //
// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
// most stable support. Since core members of the Google Test project // most stable support. Since core members of the Google Test project
...@@ -86,19 +80,18 @@ ...@@ -86,19 +80,18 @@
// googletestframework@googlegroups.com (patches for fixing them are // googletestframework@googlegroups.com (patches for fixing them are
// even more welcome!). // even more welcome!).
// //
// Note that it is possible that none of the GTEST_OS_ macros are defined. // Note that it is possible that none of the GTEST_OS_* macros are defined.
// //
// Macros indicating available Google Test features: // Macros indicating available Google Test features (defined to 1 if
// GTEST_HAS_COMBINE - defined iff Combine construct is supported // the corresponding feature is supported; otherwise undefined):
// in value-parameterized tests. // GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
// GTEST_HAS_DEATH_TEST - defined iff death tests are supported. // tests)
// GTEST_HAS_PARAM_TEST - defined iff value-parameterized tests are // GTEST_HAS_DEATH_TEST - death tests
// supported. // GTEST_HAS_PARAM_TEST - value-parameterized tests
// GTEST_HAS_TYPED_TEST - defined iff typed tests are supported. // GTEST_HAS_TYPED_TEST - typed tests
// GTEST_HAS_TYPED_TEST_P - defined iff type-parameterized tests are // GTEST_HAS_TYPED_TEST_P - type-parameterized tests
// supported. // GTEST_USES_POSIX_RE - enhanced POSIX regex is used.
// GTEST_USES_POSIX_RE - defined iff enhanced POSIX regex is used. // GTEST_USES_SIMPLE_RE - our own simple regex is used;
// GTEST_USES_SIMPLE_RE - defined iff our own simple regex is used;
// the above two are mutually exclusive. // the above two are mutually exclusive.
// //
// Macros for basic C++ coding: // Macros for basic C++ coding:
...@@ -158,9 +151,9 @@ ...@@ -158,9 +151,9 @@
#include <stdio.h> #include <stdio.h>
#include <iostream> // Used for GTEST_CHECK_ #include <iostream> // Used for GTEST_CHECK_
#define GTEST_NAME "Google Test" #define GTEST_NAME_ "Google Test"
#define GTEST_FLAG_PREFIX "gtest_" #define GTEST_FLAG_PREFIX_ "gtest_"
#define GTEST_FLAG_PREFIX_UPPER "GTEST_" #define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
// Determines the version of gcc that is used to compile this. // Determines the version of gcc that is used to compile this.
#ifdef __GNUC__ #ifdef __GNUC__
...@@ -171,26 +164,26 @@ ...@@ -171,26 +164,26 @@
// Determines the platform on which Google Test is compiled. // Determines the platform on which Google Test is compiled.
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#define GTEST_OS_CYGWIN #define GTEST_OS_CYGWIN 1
#elif __SYMBIAN32__ #elif __SYMBIAN32__
#define GTEST_OS_SYMBIAN #define GTEST_OS_SYMBIAN 1
#elif defined _MSC_VER #elif defined _MSC_VER
// TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean // TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean
// both "The OS is Windows" and "The compiler is MSVC". These // both "The OS is Windows" and "The compiler is MSVC". These
// meanings really should be separated in order to better support // meanings really should be separated in order to better support
// Windows compilers other than MSVC. // Windows compilers other than MSVC.
#define GTEST_OS_WINDOWS #define GTEST_OS_WINDOWS 1
#elif defined __APPLE__ #elif defined __APPLE__
#define GTEST_OS_MAC #define GTEST_OS_MAC 1
#elif defined __linux__ #elif defined __linux__
#define GTEST_OS_LINUX #define GTEST_OS_LINUX 1
#elif defined __MVS__ #elif defined __MVS__
#define GTEST_OS_ZOS #define GTEST_OS_ZOS 1
#elif defined(__sun) && defined(__SVR4) #elif defined(__sun) && defined(__SVR4)
#define GTEST_OS_SOLARIS #define GTEST_OS_SOLARIS 1
#endif // _MSC_VER #endif // _MSC_VER
#if defined(GTEST_OS_LINUX) #if GTEST_OS_LINUX
// On some platforms, <regex.h> needs someone to define size_t, and // On some platforms, <regex.h> needs someone to define size_t, and
// won't compile otherwise. We can #include it here as we already // won't compile otherwise. We can #include it here as we already
...@@ -255,14 +248,14 @@ ...@@ -255,14 +248,14 @@
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring // TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
// is available. // is available.
#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS) #if GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
// Cygwin 1.5 and below doesn't support ::std::wstring. // Cygwin 1.5 and below doesn't support ::std::wstring.
// Cygwin 1.7 might add wstring support; this should be updated when clear. // Cygwin 1.7 might add wstring support; this should be updated when clear.
// Solaris' libc++ doesn't support it either. // Solaris' libc++ doesn't support it either.
#define GTEST_HAS_STD_WSTRING 0 #define GTEST_HAS_STD_WSTRING 0
#else #else
#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING #define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
#endif // defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS) #endif // GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
#endif // GTEST_HAS_STD_WSTRING #endif // GTEST_HAS_STD_WSTRING
...@@ -324,13 +317,7 @@ ...@@ -324,13 +317,7 @@
// Determines whether <pthread.h> is available. // Determines whether <pthread.h> is available.
#ifndef GTEST_HAS_PTHREAD #ifndef GTEST_HAS_PTHREAD
// The user didn't tell us, so we need to figure it out. // The user didn't tell us, so we need to figure it out.
#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC)
#define GTEST_HAS_PTHREAD 1
#else
#define GTEST_HAS_PTHREAD 0
#endif // GTEST_OS_LINUX || GTEST_OS_MAC
#endif // GTEST_HAS_PTHREAD #endif // GTEST_HAS_PTHREAD
// Determines whether tr1/tuple is available. If you have tr1/tuple // Determines whether tr1/tuple is available. If you have tr1/tuple
...@@ -371,17 +358,17 @@ ...@@ -371,17 +358,17 @@
#ifndef GTEST_HAS_CLONE #ifndef GTEST_HAS_CLONE
// The user didn't tell us, so we need to figure it out. // The user didn't tell us, so we need to figure it out.
#if defined(GTEST_OS_LINUX) && !defined(__ia64__) #if GTEST_OS_LINUX && !defined(__ia64__)
#define GTEST_HAS_CLONE 1 #define GTEST_HAS_CLONE 1
#else #else
#define GTEST_HAS_CLONE 0 #define GTEST_HAS_CLONE 0
#endif // defined(GTEST_OS_LINUX) && !defined(__ia64__) #endif // GTEST_OS_LINUX && !defined(__ia64__)
#endif // GTEST_HAS_CLONE #endif // GTEST_HAS_CLONE
// Determines whether to support death tests. // Determines whether to support death tests.
#if GTEST_HAS_STD_STRING && GTEST_HAS_CLONE #if GTEST_HAS_STD_STRING && GTEST_HAS_CLONE
#define GTEST_HAS_DEATH_TEST #define GTEST_HAS_DEATH_TEST 1
#include <vector> #include <vector>
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
...@@ -392,7 +379,7 @@ ...@@ -392,7 +379,7 @@
#if defined(__GNUC__) || (_MSC_VER >= 1400) #if defined(__GNUC__) || (_MSC_VER >= 1400)
// TODO(vladl@google.com): get the implementation rid of vector and list // TODO(vladl@google.com): get the implementation rid of vector and list
// to compile on MSVC 7.1. // to compile on MSVC 7.1.
#define GTEST_HAS_PARAM_TEST #define GTEST_HAS_PARAM_TEST 1
#endif // defined(__GNUC__) || (_MSC_VER >= 1400) #endif // defined(__GNUC__) || (_MSC_VER >= 1400)
// Determines whether to support type-driven tests. // Determines whether to support type-driven tests.
...@@ -406,15 +393,13 @@ ...@@ -406,15 +393,13 @@
// Determines whether to support Combine(). This only makes sense when // Determines whether to support Combine(). This only makes sense when
// value-parameterized tests are enabled. // value-parameterized tests are enabled.
#if defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE #if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
#define GTEST_HAS_COMBINE #define GTEST_HAS_COMBINE 1
#endif // defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE #endif // GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
// Determines whether the system compiler uses UTF-16 for encoding wide strings. // Determines whether the system compiler uses UTF-16 for encoding wide strings.
#if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \ #define GTEST_WIDE_STRING_USES_UTF16_ \
defined(GTEST_OS_SYMBIAN) (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN)
#define GTEST_WIDE_STRING_USES_UTF16_ 1
#endif
// Defines some utility macros. // Defines some utility macros.
...@@ -610,7 +595,7 @@ inline void FlushInfoLog() { fflush(NULL); } ...@@ -610,7 +595,7 @@ inline void FlushInfoLog() { fflush(NULL); }
// CaptureStderr - starts capturing stderr. // CaptureStderr - starts capturing stderr.
// GetCapturedStderr - stops capturing stderr and returns the captured string. // GetCapturedStderr - stops capturing stderr and returns the captured string.
#ifdef GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
// A copy of all command line arguments. Set by InitGoogleTest(). // A copy of all command line arguments. Set by InitGoogleTest().
extern ::std::vector<String> g_argvs; extern ::std::vector<String> g_argvs;
...@@ -704,7 +689,7 @@ struct is_pointer<T*> : public true_type {}; ...@@ -704,7 +689,7 @@ struct is_pointer<T*> : public true_type {};
// Defines BiggestInt as the biggest signed integer type the compiler // Defines BiggestInt as the biggest signed integer type the compiler
// supports. // supports.
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
typedef __int64 BiggestInt; typedef __int64 BiggestInt;
#else #else
typedef long long BiggestInt; // NOLINT typedef long long BiggestInt; // NOLINT
...@@ -762,7 +747,7 @@ class TypeWithSize<4> { ...@@ -762,7 +747,7 @@ class TypeWithSize<4> {
template <> template <>
class TypeWithSize<8> { class TypeWithSize<8> {
public: public:
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
typedef __int64 Int; typedef __int64 Int;
typedef unsigned __int64 UInt; typedef unsigned __int64 UInt;
#else #else
...@@ -785,7 +770,7 @@ inline const char* GetEnv(const char* name) { ...@@ -785,7 +770,7 @@ inline const char* GetEnv(const char* name) {
#ifdef _WIN32_WCE // We are on Windows CE. #ifdef _WIN32_WCE // We are on Windows CE.
// CE has no environment variables. // CE has no environment variables.
return NULL; return NULL;
#elif defined(GTEST_OS_WINDOWS) // We are on Windows proper. #elif GTEST_OS_WINDOWS // We are on Windows proper.
// MSVC 8 deprecates getenv(), so we want to suppress warning 4996 // MSVC 8 deprecates getenv(), so we want to suppress warning 4996
// (deprecated function) there. // (deprecated function) there.
#pragma warning(push) // Saves the current warning state. #pragma warning(push) // Saves the current warning state.
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#include <gtest/internal/gtest-string.h> #include <gtest/internal/gtest-string.h>
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P) #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
#ifdef __GNUC__ #ifdef __GNUC__
#include <cxxabi.h> #include <cxxabi.h>
......
...@@ -45,7 +45,7 @@ $var n = 50 $$ Maximum length of type lists we want to support. ...@@ -45,7 +45,7 @@ $var n = 50 $$ Maximum length of type lists we want to support.
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#include <gtest/internal/gtest-string.h> #include <gtest/internal/gtest-string.h>
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P) #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
#ifdef __GNUC__ #ifdef __GNUC__
#include <cxxabi.h> #include <cxxabi.h>
......
...@@ -74,7 +74,7 @@ class PrimeTableTest : public testing::Test { ...@@ -74,7 +74,7 @@ class PrimeTableTest : public testing::Test {
PrimeTable* const table_; PrimeTable* const table_;
}; };
#ifdef GTEST_HAS_TYPED_TEST #if GTEST_HAS_TYPED_TEST
using testing::Types; using testing::Types;
...@@ -137,7 +137,7 @@ TYPED_TEST(PrimeTableTest, CanGetNextPrime) { ...@@ -137,7 +137,7 @@ TYPED_TEST(PrimeTableTest, CanGetNextPrime) {
#endif // GTEST_HAS_TYPED_TEST #endif // GTEST_HAS_TYPED_TEST
#ifdef GTEST_HAS_TYPED_TEST_P #if GTEST_HAS_TYPED_TEST_P
using testing::Types; using testing::Types;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
using ::testing::TestWithParam; using ::testing::TestWithParam;
using ::testing::Values; using ::testing::Values;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#ifdef GTEST_HAS_COMBINE #if GTEST_HAS_COMBINE
// Suppose we want to introduce a new, improved implementation of PrimeTable // Suppose we want to introduce a new, improved implementation of PrimeTable
// which combines speed of PrecalcPrimeTable and versatility of // which combines speed of PrecalcPrimeTable and versatility of
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <gtest/gtest-death-test.h> #include <gtest/gtest-death-test.h>
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#ifdef GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -48,9 +48,9 @@ ...@@ -48,9 +48,9 @@
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // his code.
#define GTEST_IMPLEMENTATION #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION #undef GTEST_IMPLEMENTATION_
namespace testing { namespace testing {
...@@ -90,7 +90,7 @@ GTEST_DEFINE_string_( ...@@ -90,7 +90,7 @@ GTEST_DEFINE_string_(
"death test. FOR INTERNAL USE ONLY."); "death test. FOR INTERNAL USE ONLY.");
} // namespace internal } // namespace internal
#ifdef GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
// ExitedWithCode constructor. // ExitedWithCode constructor.
ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) { ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
...@@ -144,7 +144,7 @@ bool ExitedUnsuccessfully(int exit_status) { ...@@ -144,7 +144,7 @@ bool ExitedUnsuccessfully(int exit_status) {
static String DeathTestThreadWarning(size_t thread_count) { static String DeathTestThreadWarning(size_t thread_count) {
Message msg; Message msg;
msg << "Death tests use fork(), which is unsafe particularly" msg << "Death tests use fork(), which is unsafe particularly"
<< " in a threaded context. For this test, " << GTEST_NAME << " "; << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
if (thread_count == 0) if (thread_count == 0)
msg << "couldn't detect the number of threads."; msg << "couldn't detect the number of threads.";
else else
...@@ -655,11 +655,11 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() { ...@@ -655,11 +655,11 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
const String filter_flag = const String filter_flag =
String::Format("--%s%s=%s.%s", String::Format("--%s%s=%s.%s",
GTEST_FLAG_PREFIX, kFilterFlag, GTEST_FLAG_PREFIX_, kFilterFlag,
info->test_case_name(), info->name()); info->test_case_name(), info->name());
const String internal_flag = const String internal_flag =
String::Format("--%s%s=%s:%d:%d:%d", String::Format("--%s%s=%s:%d:%d:%d",
GTEST_FLAG_PREFIX, kInternalRunDeathTestFlag, file_, line_, GTEST_FLAG_PREFIX_, kInternalRunDeathTestFlag, file_, line_,
death_test_index, pipe_fd[1]); death_test_index, pipe_fd[1]);
Arguments args; Arguments args;
args.AddArguments(GetArgvs()); args.AddArguments(GetArgvs());
......
...@@ -36,11 +36,11 @@ ...@@ -36,11 +36,11 @@
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
#include <windows.h> #include <windows.h>
#elif defined(GTEST_OS_WINDOWS) #elif GTEST_OS_WINDOWS
#include <direct.h> #include <direct.h>
#include <io.h> #include <io.h>
#include <sys/stat.h> #include <sys/stat.h>
#elif defined(GTEST_OS_SYMBIAN) #elif GTEST_OS_SYMBIAN
// Symbian OpenC has PATH_MAX in sys/syslimits.h // Symbian OpenC has PATH_MAX in sys/syslimits.h
#include <sys/syslimits.h> #include <sys/syslimits.h>
#include <unistd.h> #include <unistd.h>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#include <unistd.h> // NOLINT #include <unistd.h> // NOLINT
#endif // _WIN32_WCE or _WIN32 #endif // _WIN32_WCE or _WIN32
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
#define GTEST_PATH_MAX_ _MAX_PATH #define GTEST_PATH_MAX_ _MAX_PATH
#elif defined(PATH_MAX) #elif defined(PATH_MAX)
#define GTEST_PATH_MAX_ PATH_MAX #define GTEST_PATH_MAX_ PATH_MAX
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
namespace testing { namespace testing {
namespace internal { namespace internal {
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
const char kPathSeparator = '\\'; const char kPathSeparator = '\\';
const char kPathSeparatorString[] = "\\"; const char kPathSeparatorString[] = "\\";
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
...@@ -90,7 +90,7 @@ FilePath FilePath::GetCurrentDir() { ...@@ -90,7 +90,7 @@ FilePath FilePath::GetCurrentDir() {
// Windows CE doesn't have a current directory, so we just return // Windows CE doesn't have a current directory, so we just return
// something reasonable. // something reasonable.
return FilePath(kCurrentDirectoryString); return FilePath(kCurrentDirectoryString);
#elif defined(GTEST_OS_WINDOWS) #elif GTEST_OS_WINDOWS
char cwd[GTEST_PATH_MAX_ + 1] = {}; char cwd[GTEST_PATH_MAX_ + 1] = {};
return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd); return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
#else #else
...@@ -165,7 +165,7 @@ FilePath FilePath::ConcatPaths(const FilePath& directory, ...@@ -165,7 +165,7 @@ FilePath FilePath::ConcatPaths(const FilePath& directory,
// Returns true if pathname describes something findable in the file-system, // Returns true if pathname describes something findable in the file-system,
// either a file, directory, or whatever. // either a file, directory, or whatever.
bool FilePath::FileOrDirectoryExists() const { bool FilePath::FileOrDirectoryExists() const {
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str()); LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
const DWORD attributes = GetFileAttributes(unicode); const DWORD attributes = GetFileAttributes(unicode);
...@@ -185,7 +185,7 @@ bool FilePath::FileOrDirectoryExists() const { ...@@ -185,7 +185,7 @@ bool FilePath::FileOrDirectoryExists() const {
// that exists. // that exists.
bool FilePath::DirectoryExists() const { bool FilePath::DirectoryExists() const {
bool result = false; bool result = false;
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
// Don't strip off trailing separator if path is a root directory on // Don't strip off trailing separator if path is a root directory on
// Windows (like "C:\\"). // Windows (like "C:\\").
const FilePath& path(IsRootDirectory() ? *this : const FilePath& path(IsRootDirectory() ? *this :
...@@ -214,7 +214,7 @@ bool FilePath::DirectoryExists() const { ...@@ -214,7 +214,7 @@ bool FilePath::DirectoryExists() const {
// Returns true if pathname describes a root directory. (Windows has one // Returns true if pathname describes a root directory. (Windows has one
// root directory per disk drive.) // root directory per disk drive.)
bool FilePath::IsRootDirectory() const { bool FilePath::IsRootDirectory() const {
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
// TODO(wan@google.com): on Windows a network share like // TODO(wan@google.com): on Windows a network share like
// \\server\share can be a root directory, although it cannot be the // \\server\share can be a root directory, although it cannot be the
// current directory. Handle this properly. // current directory. Handle this properly.
...@@ -227,7 +227,7 @@ bool FilePath::IsRootDirectory() const { ...@@ -227,7 +227,7 @@ bool FilePath::IsRootDirectory() const {
// Returns true if pathname describes an absolute path. // Returns true if pathname describes an absolute path.
bool FilePath::IsAbsolutePath() const { bool FilePath::IsAbsolutePath() const {
const char* const name = pathname_.c_str(); const char* const name = pathname_.c_str();
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
return pathname_.GetLength() >= 3 && return pathname_.GetLength() >= 3 &&
((name[0] >= 'a' && name[0] <= 'z') || ((name[0] >= 'a' && name[0] <= 'z') ||
(name[0] >= 'A' && name[0] <= 'Z')) && (name[0] >= 'A' && name[0] <= 'Z')) &&
...@@ -285,7 +285,7 @@ bool FilePath::CreateDirectoriesRecursively() const { ...@@ -285,7 +285,7 @@ bool FilePath::CreateDirectoriesRecursively() const {
// directory for any reason, including if the parent directory does not // directory for any reason, including if the parent directory does not
// exist. Not named "CreateDirectory" because that's a macro on Windows. // exist. Not named "CreateDirectory" because that's a macro on Windows.
bool FilePath::CreateFolder() const { bool FilePath::CreateFolder() const {
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
FilePath removed_sep(this->RemoveTrailingPathSeparator()); FilePath removed_sep(this->RemoveTrailingPathSeparator());
LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str()); LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
......
...@@ -37,19 +37,19 @@ ...@@ -37,19 +37,19 @@
#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_ #ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
#define GTEST_SRC_GTEST_INTERNAL_INL_H_ #define GTEST_SRC_GTEST_INTERNAL_INL_H_
// GTEST_IMPLEMENTATION is defined iff the current translation unit is // GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
// part of Google Test's implementation. // part of Google Test's implementation; otherwise it's undefined.
#ifndef GTEST_IMPLEMENTATION #if !GTEST_IMPLEMENTATION_
// A user is trying to include this from his code - just say no. // A user is trying to include this from his code - just say no.
#error "gtest-internal-inl.h is part of Google Test's internal implementation." #error "gtest-internal-inl.h is part of Google Test's internal implementation."
#error "It must not be included except by Google Test itself." #error "It must not be included except by Google Test itself."
#endif // GTEST_IMPLEMENTATION #endif // GTEST_IMPLEMENTATION_
#include <stddef.h> #include <stddef.h>
#include <gtest/internal/gtest-port.h> #include <gtest/internal/gtest-port.h>
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
#include <windows.h> // NOLINT #include <windows.h> // NOLINT
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
...@@ -833,7 +833,7 @@ class UnitTestOptions { ...@@ -833,7 +833,7 @@ class UnitTestOptions {
static bool FilterMatchesTest(const String &test_case_name, static bool FilterMatchesTest(const String &test_case_name,
const String &test_name); const String &test_name);
#ifdef GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
// Function for supporting the gtest_catch_exception flag. // Function for supporting the gtest_catch_exception flag.
// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
...@@ -1095,7 +1095,7 @@ class UnitTestImpl { ...@@ -1095,7 +1095,7 @@ class UnitTestImpl {
tear_down_tc)->AddTestInfo(test_info); tear_down_tc)->AddTestInfo(test_info);
} }
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
// Returns ParameterizedTestCaseRegistry object used to keep track of // Returns ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them. // value-parameterized tests and instantiate and register them.
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() { internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
...@@ -1175,7 +1175,7 @@ class UnitTestImpl { ...@@ -1175,7 +1175,7 @@ class UnitTestImpl {
return gtest_trace_stack_.pointer(); return gtest_trace_stack_.pointer();
} }
#ifdef GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
// Returns a pointer to the parsed --gtest_internal_run_death_test // Returns a pointer to the parsed --gtest_internal_run_death_test
// flag, or NULL if that flag was not specified. // flag, or NULL if that flag was not specified.
// This information is useful only in a death test child process. // This information is useful only in a death test child process.
...@@ -1224,7 +1224,7 @@ class UnitTestImpl { ...@@ -1224,7 +1224,7 @@ class UnitTestImpl {
internal::List<TestCase*> test_cases_; // The list of TestCases. internal::List<TestCase*> test_cases_; // The list of TestCases.
#ifdef GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
// ParameterizedTestRegistry object used to register value-parameterized // ParameterizedTestRegistry object used to register value-parameterized
// tests. // tests.
internal::ParameterizedTestCaseRegistry parameterized_test_registry_; internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
...@@ -1273,7 +1273,7 @@ class UnitTestImpl { ...@@ -1273,7 +1273,7 @@ class UnitTestImpl {
// How long the test took to run, in milliseconds. // How long the test took to run, in milliseconds.
TimeInMillis elapsed_time_; TimeInMillis elapsed_time_;
#ifdef GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
// The decomposed components of the gtest_internal_run_death_test flag, // The decomposed components of the gtest_internal_run_death_test flag,
// parsed when RUN_ALL_TESTS is called. // parsed when RUN_ALL_TESTS is called.
internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_; internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment