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