Index: external_tests/google_test/gtest/include/gtest/gtest-spi.h |
=================================================================== |
--- a/external_tests/google_test/gtest/include/gtest/gtest-spi.h |
+++ b/external_tests/google_test/gtest/include/gtest/gtest-spi.h |
@@ -71,16 +71,17 @@ class GTEST_API_ ScopedFakeTestPartResul |
virtual ~ScopedFakeTestPartResultReporter(); |
// Appends the TestPartResult object to the TestPartResultArray |
// received in the constructor. |
// |
// This method is from the TestPartResultReporterInterface |
// interface. |
virtual void ReportTestPartResult(const TestPartResult& result); |
+ |
private: |
void Init(); |
const InterceptMode intercept_mode_; |
TestPartResultReporterInterface* old_reporter_; |
TestPartResultArray* const result_; |
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter); |
@@ -92,19 +93,19 @@ namespace internal { |
// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given |
// TestPartResultArray contains exactly one failure that has the given |
// type and contains the given substring. If that's not the case, a |
// non-fatal failure will be generated. |
class GTEST_API_ SingleFailureChecker { |
public: |
// The constructor remembers the arguments. |
SingleFailureChecker(const TestPartResultArray* results, |
- TestPartResult::Type type, |
- const string& substr); |
+ TestPartResult::Type type, const string& substr); |
~SingleFailureChecker(); |
+ |
private: |
const TestPartResultArray* const results_; |
const TestPartResult::Type type_; |
const string substr_; |
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker); |
}; |
@@ -130,48 +131,49 @@ class GTEST_API_ SingleFailureChecker { |
// - 'statement' cannot return a value. |
// - You cannot stream a failure message to this macro. |
// |
// Note that even though the implementations of the following two |
// macros are much alike, we cannot refactor them to use a common |
// helper macro, due to some peculiarity in how the preprocessor |
// works. The AcceptsMacroThatExpandsToUnprotectedComma test in |
// gtest_unittest.cc will fail to compile if we do that. |
-#define EXPECT_FATAL_FAILURE(statement, substr) \ |
- do { \ |
- class GTestExpectFatalFailureHelper {\ |
- public:\ |
- static void Execute() { statement; }\ |
- };\ |
- ::testing::TestPartResultArray gtest_failures;\ |
- ::testing::internal::SingleFailureChecker gtest_checker(\ |
- >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ |
- {\ |
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ |
- ::testing::ScopedFakeTestPartResultReporter:: \ |
- INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ |
- GTestExpectFatalFailureHelper::Execute();\ |
- }\ |
+#define EXPECT_FATAL_FAILURE(statement, substr) \ |
+ do { \ |
+ class GTestExpectFatalFailureHelper { \ |
+ public: \ |
+ static void Execute() { statement; } \ |
+ }; \ |
+ ::testing::TestPartResultArray gtest_failures; \ |
+ ::testing::internal::SingleFailureChecker gtest_checker( \ |
+ >est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \ |
+ { \ |
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \ |
+ ::testing::ScopedFakeTestPartResultReporter:: \ |
+ INTERCEPT_ONLY_CURRENT_THREAD, \ |
+ >est_failures); \ |
+ GTestExpectFatalFailureHelper::Execute(); \ |
+ } \ |
} while (::testing::internal::AlwaysFalse()) |
-#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ |
- do { \ |
- class GTestExpectFatalFailureHelper {\ |
- public:\ |
- static void Execute() { statement; }\ |
- };\ |
- ::testing::TestPartResultArray gtest_failures;\ |
- ::testing::internal::SingleFailureChecker gtest_checker(\ |
- >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ |
- {\ |
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ |
- ::testing::ScopedFakeTestPartResultReporter:: \ |
- INTERCEPT_ALL_THREADS, >est_failures);\ |
- GTestExpectFatalFailureHelper::Execute();\ |
- }\ |
+#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ |
+ do { \ |
+ class GTestExpectFatalFailureHelper { \ |
+ public: \ |
+ static void Execute() { statement; } \ |
+ }; \ |
+ ::testing::TestPartResultArray gtest_failures; \ |
+ ::testing::internal::SingleFailureChecker gtest_checker( \ |
+ >est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \ |
+ { \ |
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \ |
+ ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ |
+ >est_failures); \ |
+ GTestExpectFatalFailureHelper::Execute(); \ |
+ } \ |
} while (::testing::internal::AlwaysFalse()) |
// A macro for testing Google Test assertions or code that's expected to |
// generate Google Test non-fatal failures. It asserts that the given |
// statement will cause exactly one non-fatal Google Test failure with 'substr' |
// being part of the failure message. |
// |
// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only |
@@ -196,37 +198,42 @@ class GTEST_API_ SingleFailureChecker { |
// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc |
// catches that. |
// |
// For the same reason, we have to write |
// if (::testing::internal::AlwaysTrue()) { statement; } |
// instead of |
// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) |
// to avoid an MSVC warning on unreachable code. |
-#define EXPECT_NONFATAL_FAILURE(statement, substr) \ |
- do {\ |
- ::testing::TestPartResultArray gtest_failures;\ |
- ::testing::internal::SingleFailureChecker gtest_checker(\ |
+#define EXPECT_NONFATAL_FAILURE(statement, substr) \ |
+ do { \ |
+ ::testing::TestPartResultArray gtest_failures; \ |
+ ::testing::internal::SingleFailureChecker gtest_checker( \ |
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \ |
- (substr));\ |
- {\ |
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ |
- ::testing::ScopedFakeTestPartResultReporter:: \ |
- INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ |
- if (::testing::internal::AlwaysTrue()) { statement; }\ |
- }\ |
+ (substr)); \ |
+ { \ |
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \ |
+ ::testing::ScopedFakeTestPartResultReporter:: \ |
+ INTERCEPT_ONLY_CURRENT_THREAD, \ |
+ >est_failures); \ |
+ if (::testing::internal::AlwaysTrue()) { \ |
+ statement; \ |
+ } \ |
+ } \ |
} while (::testing::internal::AlwaysFalse()) |
-#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ |
- do {\ |
- ::testing::TestPartResultArray gtest_failures;\ |
- ::testing::internal::SingleFailureChecker gtest_checker(\ |
- >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ |
- (substr));\ |
- {\ |
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ |
+#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ |
+ do { \ |
+ ::testing::TestPartResultArray gtest_failures; \ |
+ ::testing::internal::SingleFailureChecker gtest_checker( \ |
+ >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ |
+ (substr)); \ |
+ { \ |
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \ |
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ |
- >est_failures);\ |
- if (::testing::internal::AlwaysTrue()) { statement; }\ |
- }\ |
+ >est_failures); \ |
+ if (::testing::internal::AlwaysTrue()) { \ |
+ statement; \ |
+ } \ |
+ } \ |
} while (::testing::internal::AlwaysFalse()) |
#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_ |