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
ffeb11d1
Commit
ffeb11d1
authored
Feb 22, 2011
by
zhanyong.wan
Browse files
Indents preprocessor directives.
parent
0980b4bd
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
364 additions
and
327 deletions
+364
-327
include/gtest/gtest-death-test.h
include/gtest/gtest-death-test.h
+21
-21
include/gtest/gtest-message.h
include/gtest/gtest-message.h
+1
-0
include/gtest/gtest-param-test.h
include/gtest/gtest-param-test.h
+5
-5
include/gtest/gtest-param-test.h.pump
include/gtest/gtest-param-test.h.pump
+5
-5
include/gtest/gtest-printers.h
include/gtest/gtest-printers.h
+6
-6
include/gtest/gtest-typed-test.h
include/gtest/gtest-typed-test.h
+10
-10
include/gtest/gtest.h
include/gtest/gtest.h
+17
-16
include/gtest/gtest_pred_impl.h
include/gtest/gtest_pred_impl.h
+1
-1
include/gtest/internal/gtest-death-test-internal.h
include/gtest/internal/gtest-death-test-internal.h
+9
-7
include/gtest/internal/gtest-internal.h
include/gtest/internal/gtest-internal.h
+10
-9
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-port.h
include/gtest/internal/gtest-port.h
+167
-157
include/gtest/internal/gtest-string.h
include/gtest/internal/gtest-string.h
+1
-1
include/gtest/internal/gtest-tuple.h
include/gtest/internal/gtest-tuple.h
+2
-2
include/gtest/internal/gtest-tuple.h.pump
include/gtest/internal/gtest-tuple.h.pump
+2
-2
include/gtest/internal/gtest-type-util.h
include/gtest/internal/gtest-type-util.h
+13
-11
include/gtest/internal/gtest-type-util.h.pump
include/gtest/internal/gtest-type-util.h.pump
+13
-11
src/gtest-death-test.cc
src/gtest-death-test.cc
+64
-46
src/gtest-filepath.cc
src/gtest-filepath.cc
+13
-13
No files found.
include/gtest/gtest-death-test.h
View file @
ffeb11d1
...
@@ -154,24 +154,24 @@ GTEST_DECLARE_string_(death_test_style);
...
@@ -154,24 +154,24 @@ GTEST_DECLARE_string_(death_test_style);
// Asserts that a given statement causes the program to exit, with an
// Asserts that a given statement causes the program to exit, with an
// integer exit status that satisfies predicate, and emitting error output
// integer exit status that satisfies predicate, and emitting error output
// that matches regex.
// that matches regex.
#define ASSERT_EXIT(statement, predicate, regex) \
#
define ASSERT_EXIT(statement, predicate, regex) \
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
// Like ASSERT_EXIT, but continues on to successive tests in the
// Like ASSERT_EXIT, but continues on to successive tests in the
// test case, if any:
// test case, if any:
#define EXPECT_EXIT(statement, predicate, regex) \
#
define EXPECT_EXIT(statement, predicate, regex) \
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
// Asserts that a given statement causes the program to exit, either by
// Asserts that a given statement causes the program to exit, either by
// explicitly exiting with a nonzero exit code or being killed by a
// explicitly exiting with a nonzero exit code or being killed by a
// signal, and emitting error output that matches regex.
// signal, and emitting error output that matches regex.
#define ASSERT_DEATH(statement, regex) \
#
define ASSERT_DEATH(statement, regex) \
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
// Like ASSERT_DEATH, but continues on to successive tests in the
// Like ASSERT_DEATH, but continues on to successive tests in the
// test case, if any:
// test case, if any:
#define EXPECT_DEATH(statement, regex) \
#
define EXPECT_DEATH(statement, regex) \
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
...
@@ -187,7 +187,7 @@ class GTEST_API_ ExitedWithCode {
...
@@ -187,7 +187,7 @@ class GTEST_API_ ExitedWithCode {
const
int
exit_code_
;
const
int
exit_code_
;
};
};
#if !GTEST_OS_WINDOWS
#
if !GTEST_OS_WINDOWS
// Tests that an exit code describes an exit due to termination by a
// Tests that an exit code describes an exit due to termination by a
// given signal.
// given signal.
class
GTEST_API_
KilledBySignal
{
class
GTEST_API_
KilledBySignal
{
...
@@ -197,7 +197,7 @@ class GTEST_API_ KilledBySignal {
...
@@ -197,7 +197,7 @@ class GTEST_API_ KilledBySignal {
private:
private:
const
int
signum_
;
const
int
signum_
;
};
};
#endif // !GTEST_OS_WINDOWS
#
endif // !GTEST_OS_WINDOWS
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
// The death testing framework causes this to have interesting semantics,
// The death testing framework causes this to have interesting semantics,
...
@@ -242,23 +242,23 @@ class GTEST_API_ KilledBySignal {
...
@@ -242,23 +242,23 @@ class GTEST_API_ KilledBySignal {
// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
// }, "death");
// }, "death");
//
//
#ifdef NDEBUG
#
ifdef NDEBUG
#define EXPECT_DEBUG_DEATH(statement, regex) \
#
define EXPECT_DEBUG_DEATH(statement, regex) \
do { statement; } while (::testing::internal::AlwaysFalse())
do { statement; } while (::testing::internal::AlwaysFalse())
#define ASSERT_DEBUG_DEATH(statement, regex) \
#
define ASSERT_DEBUG_DEATH(statement, regex) \
do { statement; } while (::testing::internal::AlwaysFalse())
do { statement; } while (::testing::internal::AlwaysFalse())
#else
#
else
#define EXPECT_DEBUG_DEATH(statement, regex) \
#
define EXPECT_DEBUG_DEATH(statement, regex) \
EXPECT_DEATH(statement, regex)
EXPECT_DEATH(statement, regex)
#define ASSERT_DEBUG_DEATH(statement, regex) \
#
define ASSERT_DEBUG_DEATH(statement, regex) \
ASSERT_DEATH(statement, regex)
ASSERT_DEATH(statement, regex)
#endif // NDEBUG for EXPECT_DEBUG_DEATH
#
endif // NDEBUG for EXPECT_DEBUG_DEATH
#endif // GTEST_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
...
@@ -267,14 +267,14 @@ class GTEST_API_ KilledBySignal {
...
@@ -267,14 +267,14 @@ class GTEST_API_ KilledBySignal {
// useful when you are combining death test assertions with normal test
// useful when you are combining death test assertions with normal test
// assertions in one test.
// assertions in one test.
#if GTEST_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
#
define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
EXPECT_DEATH(statement, regex)
EXPECT_DEATH(statement, regex)
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
#
define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
ASSERT_DEATH(statement, regex)
ASSERT_DEATH(statement, regex)
#else
#else
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
#
define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
#
define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
#endif
#endif
...
...
include/gtest/gtest-message.h
View file @
ffeb11d1
...
@@ -192,6 +192,7 @@ class GTEST_API_ Message {
...
@@ -192,6 +192,7 @@ class GTEST_API_ Message {
}
}
private:
private:
#if 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_
...
...
include/gtest/gtest-param-test.h
View file @
ffeb11d1
...
@@ -182,7 +182,7 @@ TEST_P(DerivedTest, DoesBlah) {
...
@@ -182,7 +182,7 @@ TEST_P(DerivedTest, DoesBlah) {
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-port.h"
#if !GTEST_OS_SYMBIAN
#if !GTEST_OS_SYMBIAN
#include <utility>
#
include <utility>
#endif
#endif
// scripts/fuse_gtest.py depends on gtest's own header being #included
// scripts/fuse_gtest.py depends on gtest's own header being #included
...
@@ -1222,7 +1222,7 @@ inline internal::ParamGenerator<bool> Bool() {
...
@@ -1222,7 +1222,7 @@ inline internal::ParamGenerator<bool> Bool() {
return
Values
(
false
,
true
);
return
Values
(
false
,
true
);
}
}
#if 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.
//
//
...
@@ -1374,11 +1374,11 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
...
@@ -1374,11 +1374,11 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
Generator10
>
(
Generator10
>
(
g1
,
g2
,
g3
,
g4
,
g5
,
g6
,
g7
,
g8
,
g9
,
g10
);
g1
,
g2
,
g3
,
g4
,
g5
,
g6
,
g7
,
g8
,
g9
,
g10
);
}
}
#endif // GTEST_HAS_COMBINE
#
endif // GTEST_HAS_COMBINE
#define TEST_P(test_case_name, test_name) \
#
define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \
: public test_case_name { \
public: \
public: \
...
@@ -1404,7 +1404,7 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
...
@@ -1404,7 +1404,7 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
#
define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
::testing::internal::ParamGenerator<test_case_name::ParamType> \
::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
int gtest_##prefix##test_case_name##_dummy_ = \
int gtest_##prefix##test_case_name##_dummy_ = \
...
...
include/gtest/gtest-param-test.h.pump
View file @
ffeb11d1
...
@@ -181,7 +181,7 @@ TEST_P(DerivedTest, DoesBlah) {
...
@@ -181,7 +181,7 @@ TEST_P(DerivedTest, DoesBlah) {
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-port.h"
#if !GTEST_OS_SYMBIAN
#if !GTEST_OS_SYMBIAN
#include <utility>
#
include <utility>
#endif
#endif
// scripts/fuse_gtest.py depends on gtest's own header being #included
// scripts/fuse_gtest.py depends on gtest's own header being #included
...
@@ -379,7 +379,7 @@ inline internal::ParamGenerator<bool> Bool() {
...
@@ -379,7 +379,7 @@ inline internal::ParamGenerator<bool> Bool() {
return
Values
(
false
,
true
);
return
Values
(
false
,
true
);
}
}
#if 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.
//
//
...
@@ -440,11 +440,11 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
...
@@ -440,11 +440,11 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
}
}
]]
]]
#endif // GTEST_HAS_COMBINE
#
endif // GTEST_HAS_COMBINE
#define TEST_P(test_case_name, test_name) \
#
define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \
: public test_case_name { \
public: \
public: \
...
@@ -470,7 +470,7 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
...
@@ -470,7 +470,7 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
#
define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
::testing::internal::ParamGenerator<test_case_name::ParamType> \
::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
int gtest_##prefix##test_case_name##_dummy_ = \
int gtest_##prefix##test_case_name##_dummy_ = \
...
...
include/gtest/gtest-printers.h
View file @
ffeb11d1
...
@@ -578,8 +578,8 @@ class UniversalPrinter {
...
@@ -578,8 +578,8 @@ class UniversalPrinter {
// MSVC warns about adding const to a function type, so we want to
// MSVC warns about adding const to a function type, so we want to
// disable the warning.
// disable the warning.
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(push) // Saves the current warning state.
#
pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4180) // Temporarily disables warning 4180.
#
pragma warning(disable:4180) // Temporarily disables warning 4180.
#endif // _MSC_VER
#endif // _MSC_VER
// Note: we deliberately don't call this PrintTo(), as that name
// Note: we deliberately don't call this PrintTo(), as that name
...
@@ -598,7 +598,7 @@ class UniversalPrinter {
...
@@ -598,7 +598,7 @@ class UniversalPrinter {
}
}
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(pop) // Restores the warning state.
#
pragma warning(pop) // Restores the warning state.
#endif // _MSC_VER
#endif // _MSC_VER
};
};
...
@@ -649,8 +649,8 @@ class UniversalPrinter<T&> {
...
@@ -649,8 +649,8 @@ class UniversalPrinter<T&> {
// MSVC warns about adding const to a function type, so we want to
// MSVC warns about adding const to a function type, so we want to
// disable the warning.
// disable the warning.
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(push) // Saves the current warning state.
#
pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4180) // Temporarily disables warning 4180.
#
pragma warning(disable:4180) // Temporarily disables warning 4180.
#endif // _MSC_VER
#endif // _MSC_VER
static
void
Print
(
const
T
&
value
,
::
std
::
ostream
*
os
)
{
static
void
Print
(
const
T
&
value
,
::
std
::
ostream
*
os
)
{
...
@@ -663,7 +663,7 @@ class UniversalPrinter<T&> {
...
@@ -663,7 +663,7 @@ class UniversalPrinter<T&> {
}
}
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(pop) // Restores the warning state.
#
pragma warning(pop) // Restores the warning state.
#endif // _MSC_VER
#endif // _MSC_VER
};
};
...
...
include/gtest/gtest-typed-test.h
View file @
ffeb11d1
...
@@ -157,16 +157,16 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
...
@@ -157,16 +157,16 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
//
//
// Expands to the name of the typedef for the type parameters of the
// Expands to the name of the typedef for the type parameters of the
// given test case.
// given test case.
#define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
#
define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
// The 'Types' template argument below must have spaces around it
// The 'Types' template argument below must have spaces around it
// since some compilers may choke on '>>' when passing a template
// since some compilers may choke on '>>' when passing a template
// instance (e.g. Types<int>)
// instance (e.g. Types<int>)
#define TYPED_TEST_CASE(CaseName, Types) \
#
define TYPED_TEST_CASE(CaseName, Types) \
typedef ::testing::internal::TypeList< Types >::type \
typedef ::testing::internal::TypeList< Types >::type \
GTEST_TYPE_PARAMS_(CaseName)
GTEST_TYPE_PARAMS_(CaseName)
#define TYPED_TEST(CaseName, TestName) \
#
define TYPED_TEST(CaseName, TestName) \
template <typename gtest_TypeParam_> \
template <typename gtest_TypeParam_> \
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
: public CaseName<gtest_TypeParam_> { \
: public CaseName<gtest_TypeParam_> { \
...
@@ -196,31 +196,31 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
...
@@ -196,31 +196,31 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
// Expands to the namespace name that the type-parameterized tests for
// Expands to the namespace name that the type-parameterized tests for
// the given type-parameterized test case are defined in. The exact
// the given type-parameterized test case are defined in. The exact
// name of the namespace is subject to change without notice.
// name of the namespace is subject to change without notice.
#define GTEST_CASE_NAMESPACE_(TestCaseName) \
#
define GTEST_CASE_NAMESPACE_(TestCaseName) \
gtest_case_##TestCaseName##_
gtest_case_##TestCaseName##_
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
//
// Expands to the name of the variable used to remember the names of
// Expands to the name of the variable used to remember the names of
// the defined tests in the given test case.
// the defined tests in the given test case.
#define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
#
define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
gtest_typed_test_case_p_state_##TestCaseName##_
gtest_typed_test_case_p_state_##TestCaseName##_
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
//
//
// Expands to the name of the variable used to remember the names of
// Expands to the name of the variable used to remember the names of
// the registered tests in the given test case.
// the registered tests in the given test case.
#define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
#
define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
gtest_registered_test_names_##TestCaseName##_
gtest_registered_test_names_##TestCaseName##_
// The variables defined in the type-parameterized test macros are
// The variables defined in the type-parameterized test macros are
// static as typically these macros are used in a .h file that can be
// static as typically these macros are used in a .h file that can be
// #included in multiple translation units linked together.
// #included in multiple translation units linked together.
#define TYPED_TEST_CASE_P(CaseName) \
#
define TYPED_TEST_CASE_P(CaseName) \
static ::testing::internal::TypedTestCasePState \
static ::testing::internal::TypedTestCasePState \
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
#define TYPED_TEST_P(CaseName, TestName) \
#
define TYPED_TEST_P(CaseName, TestName) \
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
template <typename gtest_TypeParam_> \
template <typename gtest_TypeParam_> \
class TestName : public CaseName<gtest_TypeParam_> { \
class TestName : public CaseName<gtest_TypeParam_> { \
...
@@ -236,7 +236,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
...
@@ -236,7 +236,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
template <typename gtest_TypeParam_> \
template <typename gtest_TypeParam_> \
void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
#define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
#
define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
} \
} \
...
@@ -247,7 +247,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
...
@@ -247,7 +247,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
// The 'Types' template argument below must have spaces around it
// The 'Types' template argument below must have spaces around it
// since some compilers may choke on '>>' when passing a template
// since some compilers may choke on '>>' when passing a template
// instance (e.g. Types<int>)
// instance (e.g. Types<int>)
#define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
#
define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
::testing::internal::TypeParameterizedTestCase<CaseName, \
::testing::internal::TypeParameterizedTestCase<CaseName, \
GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
...
...
include/gtest/gtest.h
View file @
ffeb11d1
...
@@ -672,6 +672,7 @@ class GTEST_API_ TestInfo {
...
@@ -672,6 +672,7 @@ class GTEST_API_ TestInfo {
const
TestResult
*
result
()
const
{
return
&
result_
;
}
const
TestResult
*
result
()
const
{
return
&
result_
;
}
private:
private:
#if 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
...
@@ -1305,8 +1306,8 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
...
@@ -1305,8 +1306,8 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
const
T1
&
expected
,
const
T1
&
expected
,
const
T2
&
actual
)
{
const
T2
&
actual
)
{
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(push) // Saves the current warning state.
#
pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4389) // Temporarily disables warning on
#
pragma warning(disable:4389) // Temporarily disables warning on
// signed/unsigned mismatch.
// signed/unsigned mismatch.
#endif
#endif
...
@@ -1315,7 +1316,7 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
...
@@ -1315,7 +1316,7 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
}
}
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(pop) // Restores the warning state.
#
pragma warning(pop) // Restores the warning state.
#endif
#endif
return
EqFailure
(
expected_expression
,
return
EqFailure
(
expected_expression
,
...
@@ -1740,7 +1741,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
...
@@ -1740,7 +1741,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// Define this macro to 1 to omit the definition of FAIL(), which is a
// Define this macro to 1 to omit the definition of FAIL(), which is a
// generic name and clashes with some other libraries.
// generic name and clashes with some other libraries.
#if !GTEST_DONT_DEFINE_FAIL
#if !GTEST_DONT_DEFINE_FAIL
#define FAIL() GTEST_FAIL()
#
define FAIL() GTEST_FAIL()
#endif
#endif
// Generates a success with a generic message.
// Generates a success with a generic message.
...
@@ -1749,7 +1750,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
...
@@ -1749,7 +1750,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// Define this macro to 1 to omit the definition of SUCCEED(), which
// Define this macro to 1 to omit the definition of SUCCEED(), which
// is a generic name and clashes with some other libraries.
// is a generic name and clashes with some other libraries.
#if !GTEST_DONT_DEFINE_SUCCEED
#if !GTEST_DONT_DEFINE_SUCCEED
#define SUCCEED() GTEST_SUCCEED()
#
define SUCCEED() GTEST_SUCCEED()
#endif
#endif
// Macros for testing exceptions.
// Macros for testing exceptions.
...
@@ -1874,27 +1875,27 @@ class TestWithParam : public Test, public WithParamInterface<T> {
...
@@ -1874,27 +1875,27 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// ASSERT_XY(), which clashes with some users' own code.
// ASSERT_XY(), which clashes with some users' own code.
#if !GTEST_DONT_DEFINE_ASSERT_EQ
#if !GTEST_DONT_DEFINE_ASSERT_EQ
#define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
#
define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
#endif
#endif
#if !GTEST_DONT_DEFINE_ASSERT_NE
#if !GTEST_DONT_DEFINE_ASSERT_NE
#define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
#
define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
#endif
#endif
#if !GTEST_DONT_DEFINE_ASSERT_LE
#if !GTEST_DONT_DEFINE_ASSERT_LE
#define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
#
define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
#endif
#endif
#if !GTEST_DONT_DEFINE_ASSERT_LT
#if !GTEST_DONT_DEFINE_ASSERT_LT
#define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
#
define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
#endif
#endif
#if !GTEST_DONT_DEFINE_ASSERT_GE
#if !GTEST_DONT_DEFINE_ASSERT_GE
#define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
#
define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
#endif
#endif
#if !GTEST_DONT_DEFINE_ASSERT_GT
#if !GTEST_DONT_DEFINE_ASSERT_GT
#define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
#
define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
#endif
#endif
// C String Comparisons. All tests treat NULL and any non-NULL string
// C String Comparisons. All tests treat NULL and any non-NULL string
...
@@ -1993,16 +1994,16 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
...
@@ -1993,16 +1994,16 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
// expected result and the actual result with both a human-readable
// expected result and the actual result with both a human-readable
// string representation of the error, if available, as well as the
// string representation of the error, if available, as well as the
// hex result code.
// hex result code.
#define EXPECT_HRESULT_SUCCEEDED(expr) \
#
define EXPECT_HRESULT_SUCCEEDED(expr) \
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
#define ASSERT_HRESULT_SUCCEEDED(expr) \
#
define ASSERT_HRESULT_SUCCEEDED(expr) \
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
#define EXPECT_HRESULT_FAILED(expr) \
#
define EXPECT_HRESULT_FAILED(expr) \
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
#define ASSERT_HRESULT_FAILED(expr) \
#
define ASSERT_HRESULT_FAILED(expr) \
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
#endif // GTEST_OS_WINDOWS
#endif // GTEST_OS_WINDOWS
...
@@ -2105,7 +2106,7 @@ bool StaticAssertTypeEq() {
...
@@ -2105,7 +2106,7 @@ bool StaticAssertTypeEq() {
// Define this macro to 1 to omit the definition of TEST(), which
// Define this macro to 1 to omit the definition of TEST(), which
// is a generic name and clashes with some other libraries.
// is a generic name and clashes with some other libraries.
#if !GTEST_DONT_DEFINE_TEST
#if !GTEST_DONT_DEFINE_TEST
#define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
#
define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
#endif
#endif
// Defines a test that uses a test fixture.
// Defines a test that uses a test fixture.
...
...
include/gtest/gtest_pred_impl.h
View file @
ffeb11d1
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
// Makes sure this header is not included before gtest.h.
// Makes sure this header is not included before gtest.h.
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
#error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
#
error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
// This header implements a family of generic predicate assertion
// This header implements a family of generic predicate assertion
...
...
include/gtest/internal/gtest-death-test-internal.h
View file @
ffeb11d1
...
@@ -157,8 +157,8 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
...
@@ -157,8 +157,8 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
// Traps C++ exceptions escaping statement and reports them as test
// Traps C++ exceptions escaping statement and reports them as test
// failures. Note that trapping SEH exceptions is not implemented here.
// failures. Note that trapping SEH exceptions is not implemented here.
#if GTEST_HAS_EXCEPTIONS
#
if GTEST_HAS_EXCEPTIONS
#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
#
define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
try { \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} catch (const ::std::exception& gtest_exception) { \
} catch (const ::std::exception& gtest_exception) { \
...
@@ -173,14 +173,16 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
...
@@ -173,14 +173,16 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
} catch (...) { \
} catch (...) { \
death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
}
}
#else
#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
# else
# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
#endif
# endif
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
// ASSERT_EXIT*, and EXPECT_EXIT*.
// ASSERT_EXIT*, and EXPECT_EXIT*.
#define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
#
define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
if (::testing::internal::AlwaysTrue()) { \
const ::testing::internal::RE& gtest_regex = (regex); \
const ::testing::internal::RE& gtest_regex = (regex); \
...
@@ -285,7 +287,7 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
...
@@ -285,7 +287,7 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
// statement unconditionally returns or throws. The Message constructor at
// statement unconditionally returns or throws. The Message constructor at
// the end allows the syntax of streaming additional messages into the
// the end allows the syntax of streaming additional messages into the
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
#define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
#
define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
if (::testing::internal::AlwaysTrue()) { \
GTEST_LOG_(WARNING) \
GTEST_LOG_(WARNING) \
...
...
include/gtest/internal/gtest-internal.h
View file @
ffeb11d1
...
@@ -40,10 +40,10 @@
...
@@ -40,10 +40,10 @@
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-port.h"
#if 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>
#include <unistd.h>
#
include <unistd.h>
#endif // GTEST_OS_LINUX
#endif // GTEST_OS_LINUX
#include <ctype.h>
#include <ctype.h>
...
@@ -156,9 +156,9 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT
...
@@ -156,9 +156,9 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT
#ifdef GTEST_ELLIPSIS_NEEDS_POD_
#ifdef GTEST_ELLIPSIS_NEEDS_POD_
// We lose support for NULL detection where the compiler doesn't like
// We lose support for NULL detection where the compiler doesn't like
// passing non-POD classes through ellipsis (...).
// passing non-POD classes through ellipsis (...).
#define GTEST_IS_NULL_LITERAL_(x) false
#
define GTEST_IS_NULL_LITERAL_(x) false
#else
#else
#define GTEST_IS_NULL_LITERAL_(x) \
#
define GTEST_IS_NULL_LITERAL_(x) \
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
#endif // GTEST_ELLIPSIS_NEEDS_POD_
#endif // GTEST_ELLIPSIS_NEEDS_POD_
...
@@ -867,11 +867,12 @@ class ImplicitlyConvertible {
...
@@ -867,11 +867,12 @@ class ImplicitlyConvertible {
// possible loss of data, so we need to temporarily disable the
// possible loss of data, so we need to temporarily disable the
// warning.
// warning.
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(push) // Saves the current warning state.
# pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4244) // Temporarily disables warning 4244.
# pragma warning(disable:4244) // Temporarily disables warning 4244.
static
const
bool
value
=
static
const
bool
value
=
sizeof
(
Helper
(
ImplicitlyConvertible
::
MakeFrom
()))
==
1
;
sizeof
(
Helper
(
ImplicitlyConvertible
::
MakeFrom
()))
==
1
;
#pragma warning(pop) // Restores the warning state.
#
pragma warning(pop) // Restores the warning state.
#else
#else
static
const
bool
value
=
static
const
bool
value
=
sizeof
(
Helper
(
ImplicitlyConvertible
::
MakeFrom
()))
==
1
;
sizeof
(
Helper
(
ImplicitlyConvertible
::
MakeFrom
()))
==
1
;
...
...
include/gtest/internal/gtest-param-util-generated.h
View file @
ffeb11d1
...
@@ -2826,7 +2826,7 @@ class ValueArray50 {
...
@@ -2826,7 +2826,7 @@ class ValueArray50 {
const
T50
v50_
;
const
T50
v50_
;
};
};
#if 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
...
@@ -4810,7 +4810,7 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
...
@@ -4810,7 +4810,7 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
const
Generator10
g10_
;
const
Generator10
g10_
;
};
// class CartesianProductHolder10
};
// class CartesianProductHolder10
#endif // GTEST_HAS_COMBINE
#
endif // GTEST_HAS_COMBINE
}
// namespace internal
}
// namespace internal
}
// namespace testing
}
// namespace testing
...
...
include/gtest/internal/gtest-param-util-generated.h.pump
View file @
ffeb11d1
...
@@ -115,7 +115,7 @@ $for j [[
...
@@ -115,7 +115,7 @@ $for j [[
]]
]]
#if 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
...
@@ -291,7 +291,7 @@ $for j [[
...
@@ -291,7 +291,7 @@ $for j [[
]]
]]
#endif // GTEST_HAS_COMBINE
#
endif // GTEST_HAS_COMBINE
}
// namespace internal
}
// namespace internal
}
// namespace testing
}
// namespace testing
...
...
include/gtest/internal/gtest-port.h
View file @
ffeb11d1
This diff is collapsed.
Click to expand it.
include/gtest/internal/gtest-string.h
View file @
ffeb11d1
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
#ifdef __BORLANDC__
#ifdef __BORLANDC__
// string.h is not guaranteed to provide strcpy on C++ Builder.
// string.h is not guaranteed to provide strcpy on C++ Builder.
#include <mem.h>
#
include <mem.h>
#endif
#endif
#include <string.h>
#include <string.h>
...
...
include/gtest/internal/gtest-tuple.h
View file @
ffeb11d1
...
@@ -44,9 +44,9 @@
...
@@ -44,9 +44,9 @@
// private as public.
// private as public.
// Sun Studio versions < 12 also have the above bug.
// Sun Studio versions < 12 also have the above bug.
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
#
define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
#else
#else
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
#
define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
private:
private:
#endif
#endif
...
...
include/gtest/internal/gtest-tuple.h.pump
View file @
ffeb11d1
...
@@ -45,9 +45,9 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
...
@@ -45,9 +45,9 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
// private as public.
// private as public.
// Sun Studio versions < 12 also have the above bug.
// Sun Studio versions < 12 also have the above bug.
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
#
define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
#else
#else
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
#
define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
private:
private:
#endif
#endif
...
...
include/gtest/internal/gtest-type-util.h
View file @
ffeb11d1
...
@@ -51,9 +51,9 @@
...
@@ -51,9 +51,9 @@
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// libstdc++ (which is where cxxabi.h comes from).
// libstdc++ (which is where cxxabi.h comes from).
#ifdef __GLIBCXX__
#
ifdef __GLIBCXX__
#include <cxxabi.h>
#
include <cxxabi.h>
#endif // __GLIBCXX__
#
endif // __GLIBCXX__
namespace
testing
{
namespace
testing
{
namespace
internal
{
namespace
internal
{
...
@@ -73,10 +73,10 @@ struct AssertTypeEq<T, T> {
...
@@ -73,10 +73,10 @@ struct AssertTypeEq<T, T> {
// GetTypeName<T>() returns a human-readable name of type T.
// GetTypeName<T>() returns a human-readable name of type T.
template
<
typename
T
>
template
<
typename
T
>
String
GetTypeName
()
{
String
GetTypeName
()
{
#if GTEST_HAS_RTTI
#
if GTEST_HAS_RTTI
const
char
*
const
name
=
typeid
(
T
).
name
();
const
char
*
const
name
=
typeid
(
T
).
name
();
#ifdef __GLIBCXX__
#
ifdef __GLIBCXX__
int
status
=
0
;
int
status
=
0
;
// gcc's implementation of typeid(T).name() mangles the type name,
// gcc's implementation of typeid(T).name() mangles the type name,
// so we have to demangle it.
// so we have to demangle it.
...
@@ -84,13 +84,15 @@ String GetTypeName() {
...
@@ -84,13 +84,15 @@ String GetTypeName() {
const
String
name_str
(
status
==
0
?
readable_name
:
name
);
const
String
name_str
(
status
==
0
?
readable_name
:
name
);
free
(
readable_name
);
free
(
readable_name
);
return
name_str
;
return
name_str
;
#else
#
else
return
name
;
return
name
;
#endif // __GLIBCXX__
# endif // __GLIBCXX__
# else
#else
return
"<type>"
;
return
"<type>"
;
#endif // GTEST_HAS_RTTI
# endif // GTEST_HAS_RTTI
}
}
// A unique type used as the default value for the arguments of class
// A unique type used as the default value for the arguments of class
...
@@ -1611,7 +1613,7 @@ struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
...
@@ -1611,7 +1613,7 @@ struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
namespace
internal
{
namespace
internal
{
#define GTEST_TEMPLATE_ template <typename T> class
#
define GTEST_TEMPLATE_ template <typename T> class
// The template "selector" struct TemplateSel<Tmpl> is used to
// The template "selector" struct TemplateSel<Tmpl> is used to
// represent Tmpl, which must be a class template with one type
// represent Tmpl, which must be a class template with one type
...
@@ -1629,7 +1631,7 @@ struct TemplateSel {
...
@@ -1629,7 +1631,7 @@ struct TemplateSel {
};
};
};
};
#define GTEST_BIND_(TmplSel, T) \
#
define GTEST_BIND_(TmplSel, T) \
TmplSel::template Bind<T>::type
TmplSel::template Bind<T>::type
// A unique struct template used as the default value for the
// A unique struct template used as the default value for the
...
...
include/gtest/internal/gtest-type-util.h.pump
View file @
ffeb11d1
...
@@ -49,9 +49,9 @@ $var n = 50 $$ Maximum length of type lists we want to support.
...
@@ -49,9 +49,9 @@ $var n = 50 $$ Maximum length of type lists we want to support.
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// libstdc++ (which is where cxxabi.h comes from).
// libstdc++ (which is where cxxabi.h comes from).
#ifdef __GLIBCXX__
#
ifdef __GLIBCXX__
#include <cxxabi.h>
#
include <cxxabi.h>
#endif // __GLIBCXX__
#
endif // __GLIBCXX__
namespace
testing
{
namespace
testing
{
namespace
internal
{
namespace
internal
{
...
@@ -71,10 +71,10 @@ struct AssertTypeEq<T, T> {
...
@@ -71,10 +71,10 @@ struct AssertTypeEq<T, T> {
// GetTypeName<T>() returns a human-readable name of type T.
// GetTypeName<T>() returns a human-readable name of type T.
template
<
typename
T
>
template
<
typename
T
>
String
GetTypeName
()
{
String
GetTypeName
()
{
#if GTEST_HAS_RTTI
#
if GTEST_HAS_RTTI
const
char
*
const
name
=
typeid
(
T
).
name
();
const
char
*
const
name
=
typeid
(
T
).
name
();
#ifdef __GLIBCXX__
#
ifdef __GLIBCXX__
int
status
=
0
;
int
status
=
0
;
// gcc's implementation of typeid(T).name() mangles the type name,
// gcc's implementation of typeid(T).name() mangles the type name,
// so we have to demangle it.
// so we have to demangle it.
...
@@ -82,13 +82,15 @@ String GetTypeName() {
...
@@ -82,13 +82,15 @@ String GetTypeName() {
const
String
name_str
(
status
==
0
?
readable_name
:
name
);
const
String
name_str
(
status
==
0
?
readable_name
:
name
);
free
(
readable_name
);
free
(
readable_name
);
return
name_str
;
return
name_str
;
#else
#
else
return
name
;
return
name
;
#endif // __GLIBCXX__
# endif // __GLIBCXX__
# else
#else
return
"<type>"
;
return
"<type>"
;
#endif // GTEST_HAS_RTTI
# endif // GTEST_HAS_RTTI
}
}
// A unique type used as the default value for the arguments of class
// A unique type used as the default value for the arguments of class
...
@@ -169,7 +171,7 @@ struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
...
@@ -169,7 +171,7 @@ struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
namespace
internal
{
namespace
internal
{
#define GTEST_TEMPLATE_ template <typename T> class
#
define GTEST_TEMPLATE_ template <typename T> class
// The template "selector" struct TemplateSel<Tmpl> is used to
// The template "selector" struct TemplateSel<Tmpl> is used to
// represent Tmpl, which must be a class template with one type
// represent Tmpl, which must be a class template with one type
...
@@ -187,7 +189,7 @@ struct TemplateSel {
...
@@ -187,7 +189,7 @@ struct TemplateSel {
};
};
};
};
#define GTEST_BIND_(TmplSel, T) \
#
define GTEST_BIND_(TmplSel, T) \
TmplSel::template Bind<T>::type
TmplSel::template Bind<T>::type
// A unique struct template used as the default value for the
// A unique struct template used as the default value for the
...
...
src/gtest-death-test.cc
View file @
ffeb11d1
...
@@ -36,21 +36,21 @@
...
@@ -36,21 +36,21 @@
#if GTEST_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
#if GTEST_OS_MAC
#
if GTEST_OS_MAC
#include <crt_externs.h>
#
include <crt_externs.h>
#endif // GTEST_OS_MAC
#
endif // GTEST_OS_MAC
#include <errno.h>
#
include <errno.h>
#include <fcntl.h>
#
include <fcntl.h>
#include <limits.h>
#
include <limits.h>
#include <stdarg.h>
#
include <stdarg.h>
#if GTEST_OS_WINDOWS
#
if GTEST_OS_WINDOWS
#include <windows.h>
#
include <windows.h>
#else
#
else
#include <sys/mman.h>
#
include <sys/mman.h>
#include <sys/wait.h>
#
include <sys/wait.h>
#endif // GTEST_OS_WINDOWS
#
endif // GTEST_OS_WINDOWS
#endif // GTEST_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
...
@@ -113,14 +113,18 @@ ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
...
@@ -113,14 +113,18 @@ ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
// ExitedWithCode function-call operator.
// ExitedWithCode function-call operator.
bool
ExitedWithCode
::
operator
()(
int
exit_status
)
const
{
bool
ExitedWithCode
::
operator
()(
int
exit_status
)
const
{
#if GTEST_OS_WINDOWS
# if GTEST_OS_WINDOWS
return
exit_status
==
exit_code_
;
return
exit_status
==
exit_code_
;
#else
# else
return
WIFEXITED
(
exit_status
)
&&
WEXITSTATUS
(
exit_status
)
==
exit_code_
;
return
WIFEXITED
(
exit_status
)
&&
WEXITSTATUS
(
exit_status
)
==
exit_code_
;
#endif // GTEST_OS_WINDOWS
# endif // GTEST_OS_WINDOWS
}
}
#if !GTEST_OS_WINDOWS
#
if !GTEST_OS_WINDOWS
// KilledBySignal constructor.
// KilledBySignal constructor.
KilledBySignal
::
KilledBySignal
(
int
signum
)
:
signum_
(
signum
)
{
KilledBySignal
::
KilledBySignal
(
int
signum
)
:
signum_
(
signum
)
{
}
}
...
@@ -129,7 +133,7 @@ KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
...
@@ -129,7 +133,7 @@ KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
bool
KilledBySignal
::
operator
()(
int
exit_status
)
const
{
bool
KilledBySignal
::
operator
()(
int
exit_status
)
const
{
return
WIFSIGNALED
(
exit_status
)
&&
WTERMSIG
(
exit_status
)
==
signum_
;
return
WIFSIGNALED
(
exit_status
)
&&
WTERMSIG
(
exit_status
)
==
signum_
;
}
}
#endif // !GTEST_OS_WINDOWS
#
endif // !GTEST_OS_WINDOWS
namespace
internal
{
namespace
internal
{
...
@@ -139,20 +143,25 @@ namespace internal {
...
@@ -139,20 +143,25 @@ namespace internal {
// specified by wait(2).
// specified by wait(2).
static
String
ExitSummary
(
int
exit_code
)
{
static
String
ExitSummary
(
int
exit_code
)
{
Message
m
;
Message
m
;
#if GTEST_OS_WINDOWS
# if GTEST_OS_WINDOWS
m
<<
"Exited with exit status "
<<
exit_code
;
m
<<
"Exited with exit status "
<<
exit_code
;
#else
# else
if
(
WIFEXITED
(
exit_code
))
{
if
(
WIFEXITED
(
exit_code
))
{
m
<<
"Exited with exit status "
<<
WEXITSTATUS
(
exit_code
);
m
<<
"Exited with exit status "
<<
WEXITSTATUS
(
exit_code
);
}
else
if
(
WIFSIGNALED
(
exit_code
))
{
}
else
if
(
WIFSIGNALED
(
exit_code
))
{
m
<<
"Terminated by signal "
<<
WTERMSIG
(
exit_code
);
m
<<
"Terminated by signal "
<<
WTERMSIG
(
exit_code
);
}
}
#ifdef WCOREDUMP
#
ifdef WCOREDUMP
if
(
WCOREDUMP
(
exit_code
))
{
if
(
WCOREDUMP
(
exit_code
))
{
m
<<
" (core dumped)"
;
m
<<
" (core dumped)"
;
}
}
#endif
# endif
#endif // GTEST_OS_WINDOWS
# endif // GTEST_OS_WINDOWS
return
m
.
GetString
();
return
m
.
GetString
();
}
}
...
@@ -162,7 +171,7 @@ bool ExitedUnsuccessfully(int exit_status) {
...
@@ -162,7 +171,7 @@ bool ExitedUnsuccessfully(int exit_status) {
return
!
ExitedWithCode
(
0
)(
exit_status
);
return
!
ExitedWithCode
(
0
)(
exit_status
);
}
}
#if !GTEST_OS_WINDOWS
#
if !GTEST_OS_WINDOWS
// Generates a textual failure message when a death test finds more than
// Generates a textual failure message when a death test finds more than
// one thread running, or cannot determine the number of threads, prior
// one thread running, or cannot determine the number of threads, prior
// to executing the given statement. It is the responsibility of the
// to executing the given statement. It is the responsibility of the
...
@@ -177,7 +186,7 @@ static String DeathTestThreadWarning(size_t thread_count) {
...
@@ -177,7 +186,7 @@ static String DeathTestThreadWarning(size_t thread_count) {
msg
<<
"detected "
<<
thread_count
<<
" threads."
;
msg
<<
"detected "
<<
thread_count
<<
" threads."
;
return
msg
.
GetString
();
return
msg
.
GetString
();
}
}
#endif // !GTEST_OS_WINDOWS
#
endif // !GTEST_OS_WINDOWS
// Flag characters for reporting a death test that did not die.
// Flag characters for reporting a death test that did not die.
static
const
char
kDeathTestLived
=
'L'
;
static
const
char
kDeathTestLived
=
'L'
;
...
@@ -222,7 +231,7 @@ void DeathTestAbort(const String& message) {
...
@@ -222,7 +231,7 @@ void DeathTestAbort(const String& message) {
// A replacement for CHECK that calls DeathTestAbort if the assertion
// A replacement for CHECK that calls DeathTestAbort if the assertion
// fails.
// fails.
#define GTEST_DEATH_TEST_CHECK_(expression) \
#
define GTEST_DEATH_TEST_CHECK_(expression) \
do { \
do { \
if (!::testing::internal::IsTrue(expression)) { \
if (!::testing::internal::IsTrue(expression)) { \
DeathTestAbort(::testing::internal::String::Format( \
DeathTestAbort(::testing::internal::String::Format( \
...
@@ -238,7 +247,7 @@ void DeathTestAbort(const String& message) {
...
@@ -238,7 +247,7 @@ void DeathTestAbort(const String& message) {
// evaluates the expression as long as it evaluates to -1 and sets
// evaluates the expression as long as it evaluates to -1 and sets
// errno to EINTR. If the expression evaluates to -1 but errno is
// errno to EINTR. If the expression evaluates to -1 but errno is
// something other than EINTR, DeathTestAbort is called.
// something other than EINTR, DeathTestAbort is called.
#define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
#
define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
do { \
do { \
int gtest_retval; \
int gtest_retval; \
do { \
do { \
...
@@ -527,7 +536,7 @@ bool DeathTestImpl::Passed(bool status_ok) {
...
@@ -527,7 +536,7 @@ bool DeathTestImpl::Passed(bool status_ok) {
return
success
;
return
success
;
}
}
#if GTEST_OS_WINDOWS
#
if GTEST_OS_WINDOWS
// WindowsDeathTest implements death tests on Windows. Due to the
// WindowsDeathTest implements death tests on Windows. Due to the
// specifics of starting new processes on Windows, death tests there are
// specifics of starting new processes on Windows, death tests there are
// always threadsafe, and Google Test considers the
// always threadsafe, and Google Test considers the
...
@@ -723,7 +732,7 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() {
...
@@ -723,7 +732,7 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() {
set_spawned
(
true
);
set_spawned
(
true
);
return
OVERSEE_TEST
;
return
OVERSEE_TEST
;
}
}
#else // We are not on Windows.
#
else // We are not on Windows.
// ForkingDeathTest provides implementations for most of the abstract
// ForkingDeathTest provides implementations for most of the abstract
// methods of the DeathTest interface. Only the AssumeRole method is
// methods of the DeathTest interface. Only the AssumeRole method is
...
@@ -871,19 +880,19 @@ struct ExecDeathTestArgs {
...
@@ -871,19 +880,19 @@ struct ExecDeathTestArgs {
int
close_fd
;
// File descriptor to close; the read end of a pipe
int
close_fd
;
// File descriptor to close; the read end of a pipe
};
};
#if GTEST_OS_MAC
#
if GTEST_OS_MAC
inline
char
**
GetEnviron
()
{
inline
char
**
GetEnviron
()
{
// When Google Test is built as a framework on MacOS X, the environ variable
// When Google Test is built as a framework on MacOS X, the environ variable
// is unavailable. Apple's documentation (man environ) recommends using
// is unavailable. Apple's documentation (man environ) recommends using
// _NSGetEnviron() instead.
// _NSGetEnviron() instead.
return
*
_NSGetEnviron
();
return
*
_NSGetEnviron
();
}
}
#else
#
else
// Some POSIX platforms expect you to declare environ. extern "C" makes
// Some POSIX platforms expect you to declare environ. extern "C" makes
// it reside in the global namespace.
// it reside in the global namespace.
extern
"C"
char
**
environ
;
extern
"C"
char
**
environ
;
inline
char
**
GetEnviron
()
{
return
environ
;
}
inline
char
**
GetEnviron
()
{
return
environ
;
}
#endif // GTEST_OS_MAC
#
endif // GTEST_OS_MAC
// The main function for a threadsafe-style death test child process.
// The main function for a threadsafe-style death test child process.
// This function is called in a clone()-ed process and thus must avoid
// This function is called in a clone()-ed process and thus must avoid
...
@@ -940,7 +949,7 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
...
@@ -940,7 +949,7 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
ExecDeathTestArgs
args
=
{
argv
,
close_fd
};
ExecDeathTestArgs
args
=
{
argv
,
close_fd
};
pid_t
child_pid
=
-
1
;
pid_t
child_pid
=
-
1
;
#if GTEST_HAS_CLONE
#
if GTEST_HAS_CLONE
const
bool
use_fork
=
GTEST_FLAG
(
death_test_use_fork
);
const
bool
use_fork
=
GTEST_FLAG
(
death_test_use_fork
);
if
(
!
use_fork
)
{
if
(
!
use_fork
)
{
...
@@ -957,9 +966,9 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
...
@@ -957,9 +966,9 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
GTEST_DEATH_TEST_CHECK_
(
munmap
(
stack
,
stack_size
)
!=
-
1
);
GTEST_DEATH_TEST_CHECK_
(
munmap
(
stack
,
stack_size
)
!=
-
1
);
}
}
#else
#
else
const
bool
use_fork
=
true
;
const
bool
use_fork
=
true
;
#endif // GTEST_HAS_CLONE
#
endif // GTEST_HAS_CLONE
if
(
use_fork
&&
(
child_pid
=
fork
())
==
0
)
{
if
(
use_fork
&&
(
child_pid
=
fork
())
==
0
)
{
ExecDeathTestChildMain
(
&
args
);
ExecDeathTestChildMain
(
&
args
);
...
@@ -1020,7 +1029,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
...
@@ -1020,7 +1029,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
return
OVERSEE_TEST
;
return
OVERSEE_TEST
;
}
}
#endif // !GTEST_OS_WINDOWS
#
endif // !GTEST_OS_WINDOWS
// Creates a concrete DeathTest-derived class that depends on the
// Creates a concrete DeathTest-derived class that depends on the
// --gtest_death_test_style flag, and sets the pointer pointed to
// --gtest_death_test_style flag, and sets the pointer pointed to
...
@@ -1051,18 +1060,23 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
...
@@ -1051,18 +1060,23 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
}
}
}
}
#if GTEST_OS_WINDOWS
# if GTEST_OS_WINDOWS
if
(
GTEST_FLAG
(
death_test_style
)
==
"threadsafe"
||
if
(
GTEST_FLAG
(
death_test_style
)
==
"threadsafe"
||
GTEST_FLAG
(
death_test_style
)
==
"fast"
)
{
GTEST_FLAG
(
death_test_style
)
==
"fast"
)
{
*
test
=
new
WindowsDeathTest
(
statement
,
regex
,
file
,
line
);
*
test
=
new
WindowsDeathTest
(
statement
,
regex
,
file
,
line
);
}
}
#else
# else
if
(
GTEST_FLAG
(
death_test_style
)
==
"threadsafe"
)
{
if
(
GTEST_FLAG
(
death_test_style
)
==
"threadsafe"
)
{
*
test
=
new
ExecDeathTest
(
statement
,
regex
,
file
,
line
);
*
test
=
new
ExecDeathTest
(
statement
,
regex
,
file
,
line
);
}
else
if
(
GTEST_FLAG
(
death_test_style
)
==
"fast"
)
{
}
else
if
(
GTEST_FLAG
(
death_test_style
)
==
"fast"
)
{
*
test
=
new
NoExecDeathTest
(
statement
,
regex
);
*
test
=
new
NoExecDeathTest
(
statement
,
regex
);
}
}
#endif // GTEST_OS_WINDOWS
# endif // GTEST_OS_WINDOWS
else
{
// NOLINT - this is more readable than unbalanced brackets inside #if.
else
{
// NOLINT - this is more readable than unbalanced brackets inside #if.
DeathTest
::
set_last_death_test_message
(
String
::
Format
(
DeathTest
::
set_last_death_test_message
(
String
::
Format
(
"Unknown death test style
\"
%s
\"
encountered"
,
"Unknown death test style
\"
%s
\"
encountered"
,
...
@@ -1093,7 +1107,7 @@ static void SplitString(const ::std::string& str, char delimiter,
...
@@ -1093,7 +1107,7 @@ static void SplitString(const ::std::string& str, char delimiter,
dest
->
swap
(
parsed
);
dest
->
swap
(
parsed
);
}
}
#if GTEST_OS_WINDOWS
#
if GTEST_OS_WINDOWS
// Recreates the pipe and event handles from the provided parameters,
// Recreates the pipe and event handles from the provided parameters,
// signals the event, and returns a file descriptor wrapped around the pipe
// signals the event, and returns a file descriptor wrapped around the pipe
// handle. This function is called in the child process only.
// handle. This function is called in the child process only.
...
@@ -1157,7 +1171,7 @@ int GetStatusFileDescriptor(unsigned int parent_process_id,
...
@@ -1157,7 +1171,7 @@ int GetStatusFileDescriptor(unsigned int parent_process_id,
return
write_fd
;
return
write_fd
;
}
}
#endif // GTEST_OS_WINDOWS
#
endif // GTEST_OS_WINDOWS
// Returns a newly created InternalRunDeathTestFlag object with fields
// Returns a newly created InternalRunDeathTestFlag object with fields
// initialized from the GTEST_FLAG(internal_run_death_test) flag if
// initialized from the GTEST_FLAG(internal_run_death_test) flag if
...
@@ -1173,7 +1187,8 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
...
@@ -1173,7 +1187,8 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
SplitString
(
GTEST_FLAG
(
internal_run_death_test
).
c_str
(),
'|'
,
&
fields
);
SplitString
(
GTEST_FLAG
(
internal_run_death_test
).
c_str
(),
'|'
,
&
fields
);
int
write_fd
=
-
1
;
int
write_fd
=
-
1
;
#if GTEST_OS_WINDOWS
# if GTEST_OS_WINDOWS
unsigned
int
parent_process_id
=
0
;
unsigned
int
parent_process_id
=
0
;
size_t
write_handle_as_size_t
=
0
;
size_t
write_handle_as_size_t
=
0
;
size_t
event_handle_as_size_t
=
0
;
size_t
event_handle_as_size_t
=
0
;
...
@@ -1191,7 +1206,8 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
...
@@ -1191,7 +1206,8 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
write_fd
=
GetStatusFileDescriptor
(
parent_process_id
,
write_fd
=
GetStatusFileDescriptor
(
parent_process_id
,
write_handle_as_size_t
,
write_handle_as_size_t
,
event_handle_as_size_t
);
event_handle_as_size_t
);
#else
# else
if
(
fields
.
size
()
!=
4
if
(
fields
.
size
()
!=
4
||
!
ParseNaturalNumber
(
fields
[
1
],
&
line
)
||
!
ParseNaturalNumber
(
fields
[
1
],
&
line
)
||
!
ParseNaturalNumber
(
fields
[
2
],
&
index
)
||
!
ParseNaturalNumber
(
fields
[
2
],
&
index
)
...
@@ -1200,7 +1216,9 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
...
@@ -1200,7 +1216,9 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
"Bad --gtest_internal_run_death_test flag: %s"
,
"Bad --gtest_internal_run_death_test flag: %s"
,
GTEST_FLAG
(
internal_run_death_test
).
c_str
()));
GTEST_FLAG
(
internal_run_death_test
).
c_str
()));
}
}
#endif // GTEST_OS_WINDOWS
# endif // GTEST_OS_WINDOWS
return
new
InternalRunDeathTestFlag
(
fields
[
0
],
line
,
index
,
write_fd
);
return
new
InternalRunDeathTestFlag
(
fields
[
0
],
line
,
index
,
write_fd
);
}
}
...
...
src/gtest-filepath.cc
View file @
ffeb11d1
...
@@ -35,26 +35,26 @@
...
@@ -35,26 +35,26 @@
#include <stdlib.h>
#include <stdlib.h>
#if GTEST_OS_WINDOWS_MOBILE
#if GTEST_OS_WINDOWS_MOBILE
#include <windows.h>
#
include <windows.h>
#elif GTEST_OS_WINDOWS
#elif GTEST_OS_WINDOWS
#include <direct.h>
#
include <direct.h>
#include <io.h>
#
include <io.h>
#elif GTEST_OS_SYMBIAN || GTEST_OS_NACL
#elif GTEST_OS_SYMBIAN || GTEST_OS_NACL
// Symbian OpenC and NaCl have PATH_MAX in sys/syslimits.h
// Symbian OpenC and NaCl have PATH_MAX in sys/syslimits.h
#include <sys/syslimits.h>
#
include <sys/syslimits.h>
#else
#else
#include <limits.h>
#
include <limits.h>
#include <climits> // Some Linux distributions define PATH_MAX here.
#
include <climits> // Some Linux distributions define PATH_MAX here.
#endif // GTEST_OS_WINDOWS_MOBILE
#endif // GTEST_OS_WINDOWS_MOBILE
#if 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
#elif defined(_XOPEN_PATH_MAX)
#elif defined(_XOPEN_PATH_MAX)
#define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
#
define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
#else
#else
#define GTEST_PATH_MAX_ _POSIX_PATH_MAX
#
define GTEST_PATH_MAX_ _POSIX_PATH_MAX
#endif // GTEST_OS_WINDOWS
#endif // GTEST_OS_WINDOWS
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-string.h"
...
@@ -71,16 +71,16 @@ const char kPathSeparator = '\\';
...
@@ -71,16 +71,16 @@ const char kPathSeparator = '\\';
const
char
kAlternatePathSeparator
=
'/'
;
const
char
kAlternatePathSeparator
=
'/'
;
const
char
kPathSeparatorString
[]
=
"
\\
"
;
const
char
kPathSeparatorString
[]
=
"
\\
"
;
const
char
kAlternatePathSeparatorString
[]
=
"/"
;
const
char
kAlternatePathSeparatorString
[]
=
"/"
;
#if GTEST_OS_WINDOWS_MOBILE
#
if GTEST_OS_WINDOWS_MOBILE
// Windows CE doesn't have a current directory. You should not use
// Windows CE doesn't have a current directory. You should not use
// the current directory in tests on Windows CE, but this at least
// the current directory in tests on Windows CE, but this at least
// provides a reasonable fallback.
// provides a reasonable fallback.
const
char
kCurrentDirectoryString
[]
=
"
\\
"
;
const
char
kCurrentDirectoryString
[]
=
"
\\
"
;
// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
const
DWORD
kInvalidFileAttributes
=
0xffffffff
;
const
DWORD
kInvalidFileAttributes
=
0xffffffff
;
#else
#
else
const
char
kCurrentDirectoryString
[]
=
".
\\
"
;
const
char
kCurrentDirectoryString
[]
=
".
\\
"
;
#endif // GTEST_OS_WINDOWS_MOBILE
#
endif // GTEST_OS_WINDOWS_MOBILE
#else
#else
const
char
kPathSeparator
=
'/'
;
const
char
kPathSeparator
=
'/'
;
const
char
kPathSeparatorString
[]
=
"/"
;
const
char
kPathSeparatorString
[]
=
"/"
;
...
...
Prev
1
2
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