mirror of
https://github.com/google/googletest.git
synced 2025-12-06 16:57:00 +08:00
Merge 8927610cac02042ef63d1327d491e304d0a2e190 into 1b96fa13f549387b7549cc89e1a785cf143a1a50
This commit is contained in:
commit
d76b027b1a
@ -153,10 +153,10 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|||||||
static void Execute() { statement; } \
|
static void Execute() { statement; } \
|
||||||
}; \
|
}; \
|
||||||
::testing::TestPartResultArray gtest_failures; \
|
::testing::TestPartResultArray gtest_failures; \
|
||||||
::testing::internal::SingleFailureChecker gtest_checker( \
|
const ::testing::internal::SingleFailureChecker gtest_checker( \
|
||||||
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \
|
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \
|
||||||
{ \
|
{ \
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
const ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
||||||
::testing::ScopedFakeTestPartResultReporter:: \
|
::testing::ScopedFakeTestPartResultReporter:: \
|
||||||
INTERCEPT_ONLY_CURRENT_THREAD, \
|
INTERCEPT_ONLY_CURRENT_THREAD, \
|
||||||
>est_failures); \
|
>est_failures); \
|
||||||
@ -171,10 +171,10 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|||||||
static void Execute() { statement; } \
|
static void Execute() { statement; } \
|
||||||
}; \
|
}; \
|
||||||
::testing::TestPartResultArray gtest_failures; \
|
::testing::TestPartResultArray gtest_failures; \
|
||||||
::testing::internal::SingleFailureChecker gtest_checker( \
|
const ::testing::internal::SingleFailureChecker gtest_checker( \
|
||||||
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \
|
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \
|
||||||
{ \
|
{ \
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
const ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
||||||
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
||||||
>est_failures); \
|
>est_failures); \
|
||||||
GTestExpectFatalFailureHelper::Execute(); \
|
GTestExpectFatalFailureHelper::Execute(); \
|
||||||
@ -214,31 +214,31 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|||||||
// instead of
|
// instead of
|
||||||
// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
||||||
// to avoid an MSVC warning on unreachable code.
|
// to avoid an MSVC warning on unreachable code.
|
||||||
#define EXPECT_NONFATAL_FAILURE(statement, substr) \
|
#define EXPECT_NONFATAL_FAILURE(statement, substr) \
|
||||||
do { \
|
do { \
|
||||||
::testing::TestPartResultArray gtest_failures; \
|
::testing::TestPartResultArray gtest_failures; \
|
||||||
::testing::internal::SingleFailureChecker gtest_checker( \
|
const ::testing::internal::SingleFailureChecker gtest_checker( \
|
||||||
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
||||||
(substr)); \
|
(substr)); \
|
||||||
{ \
|
{ \
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
const ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
||||||
::testing::ScopedFakeTestPartResultReporter:: \
|
::testing::ScopedFakeTestPartResultReporter:: \
|
||||||
INTERCEPT_ONLY_CURRENT_THREAD, \
|
INTERCEPT_ONLY_CURRENT_THREAD, \
|
||||||
>est_failures); \
|
>est_failures); \
|
||||||
if (::testing::internal::AlwaysTrue()) { \
|
if (::testing::internal::AlwaysTrue()) { \
|
||||||
statement; \
|
statement; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (::testing::internal::AlwaysFalse())
|
} while (::testing::internal::AlwaysFalse())
|
||||||
|
|
||||||
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
||||||
do { \
|
do { \
|
||||||
::testing::TestPartResultArray gtest_failures; \
|
::testing::TestPartResultArray gtest_failures; \
|
||||||
::testing::internal::SingleFailureChecker gtest_checker( \
|
const ::testing::internal::SingleFailureChecker gtest_checker( \
|
||||||
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
||||||
(substr)); \
|
(substr)); \
|
||||||
{ \
|
{ \
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
const ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
||||||
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
||||||
>est_failures); \
|
>est_failures); \
|
||||||
if (::testing::internal::AlwaysTrue()) { \
|
if (::testing::internal::AlwaysTrue()) { \
|
||||||
|
|||||||
@ -218,35 +218,35 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
|
|||||||
|
|
||||||
// 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_or_matcher, fail) \
|
#define GTEST_DEATH_TEST_(statement, predicate, regex_or_matcher, fail) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (::testing::internal::AlwaysTrue()) { \
|
if (::testing::internal::AlwaysTrue()) { \
|
||||||
::testing::internal::DeathTest* gtest_dt; \
|
::testing::internal::DeathTest* gtest_dt; \
|
||||||
if (!::testing::internal::DeathTest::Create( \
|
if (!::testing::internal::DeathTest::Create( \
|
||||||
#statement, \
|
#statement, \
|
||||||
::testing::internal::MakeDeathTestMatcher(regex_or_matcher), \
|
::testing::internal::MakeDeathTestMatcher(regex_or_matcher), \
|
||||||
__FILE__, __LINE__, >est_dt)) { \
|
__FILE__, __LINE__, >est_dt)) { \
|
||||||
goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
|
goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
|
||||||
} \
|
} \
|
||||||
if (gtest_dt != nullptr) { \
|
if (gtest_dt != nullptr) { \
|
||||||
std::unique_ptr< ::testing::internal::DeathTest> gtest_dt_ptr(gtest_dt); \
|
const std::unique_ptr< ::testing::internal::DeathTest> gtest_dt_ptr(gtest_dt); \
|
||||||
switch (gtest_dt->AssumeRole()) { \
|
switch (gtest_dt->AssumeRole()) { \
|
||||||
case ::testing::internal::DeathTest::OVERSEE_TEST: \
|
case ::testing::internal::DeathTest::OVERSEE_TEST: \
|
||||||
if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
|
if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
|
||||||
goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
|
goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
|
||||||
} \
|
} \
|
||||||
break; \
|
break; \
|
||||||
case ::testing::internal::DeathTest::EXECUTE_TEST: { \
|
case ::testing::internal::DeathTest::EXECUTE_TEST: { \
|
||||||
const ::testing::internal::DeathTest::ReturnSentinel gtest_sentinel( \
|
const ::testing::internal::DeathTest::ReturnSentinel gtest_sentinel( \
|
||||||
gtest_dt); \
|
gtest_dt); \
|
||||||
GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
|
GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
|
||||||
gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
|
gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} else \
|
} else \
|
||||||
GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__) \
|
GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__) \
|
||||||
: fail(::testing::internal::DeathTest::LastMessage())
|
: fail(::testing::internal::DeathTest::LastMessage())
|
||||||
// The symbol "fail" here expands to something into which a message
|
// The symbol "fail" here expands to something into which a message
|
||||||
// can be streamed.
|
// can be streamed.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user