10a39d0a697ff3603e8c100300fda363658e10b23James Zern// Copyright 2007, Google Inc. 20a39d0a697ff3603e8c100300fda363658e10b23James Zern// All rights reserved. 30a39d0a697ff3603e8c100300fda363658e10b23James Zern// 40a39d0a697ff3603e8c100300fda363658e10b23James Zern// Redistribution and use in source and binary forms, with or without 50a39d0a697ff3603e8c100300fda363658e10b23James Zern// modification, are permitted provided that the following conditions are 60a39d0a697ff3603e8c100300fda363658e10b23James Zern// met: 70a39d0a697ff3603e8c100300fda363658e10b23James Zern// 80a39d0a697ff3603e8c100300fda363658e10b23James Zern// * Redistributions of source code must retain the above copyright 90a39d0a697ff3603e8c100300fda363658e10b23James Zern// notice, this list of conditions and the following disclaimer. 100a39d0a697ff3603e8c100300fda363658e10b23James Zern// * Redistributions in binary form must reproduce the above 110a39d0a697ff3603e8c100300fda363658e10b23James Zern// copyright notice, this list of conditions and the following disclaimer 120a39d0a697ff3603e8c100300fda363658e10b23James Zern// in the documentation and/or other materials provided with the 130a39d0a697ff3603e8c100300fda363658e10b23James Zern// distribution. 140a39d0a697ff3603e8c100300fda363658e10b23James Zern// * Neither the name of Google Inc. nor the names of its 150a39d0a697ff3603e8c100300fda363658e10b23James Zern// contributors may be used to endorse or promote products derived from 160a39d0a697ff3603e8c100300fda363658e10b23James Zern// this software without specific prior written permission. 170a39d0a697ff3603e8c100300fda363658e10b23James Zern// 180a39d0a697ff3603e8c100300fda363658e10b23James Zern// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 190a39d0a697ff3603e8c100300fda363658e10b23James Zern// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 200a39d0a697ff3603e8c100300fda363658e10b23James Zern// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 210a39d0a697ff3603e8c100300fda363658e10b23James Zern// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 220a39d0a697ff3603e8c100300fda363658e10b23James Zern// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 230a39d0a697ff3603e8c100300fda363658e10b23James Zern// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 240a39d0a697ff3603e8c100300fda363658e10b23James Zern// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 250a39d0a697ff3603e8c100300fda363658e10b23James Zern// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 260a39d0a697ff3603e8c100300fda363658e10b23James Zern// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 270a39d0a697ff3603e8c100300fda363658e10b23James Zern// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 280a39d0a697ff3603e8c100300fda363658e10b23James Zern// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 290a39d0a697ff3603e8c100300fda363658e10b23James Zern// 300a39d0a697ff3603e8c100300fda363658e10b23James Zern// Author: wan@google.com (Zhanyong Wan) 310a39d0a697ff3603e8c100300fda363658e10b23James Zern// 320a39d0a697ff3603e8c100300fda363658e10b23James Zern// Utilities for testing Google Test itself and code that uses Google Test 330a39d0a697ff3603e8c100300fda363658e10b23James Zern// (e.g. frameworks built on top of Google Test). 340a39d0a697ff3603e8c100300fda363658e10b23James Zern 350a39d0a697ff3603e8c100300fda363658e10b23James Zern#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_ 360a39d0a697ff3603e8c100300fda363658e10b23James Zern#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_ 370a39d0a697ff3603e8c100300fda363658e10b23James Zern 380a39d0a697ff3603e8c100300fda363658e10b23James Zern#include "gtest/gtest.h" 390a39d0a697ff3603e8c100300fda363658e10b23James Zern 400a39d0a697ff3603e8c100300fda363658e10b23James Zernnamespace testing { 410a39d0a697ff3603e8c100300fda363658e10b23James Zern 420a39d0a697ff3603e8c100300fda363658e10b23James Zern// This helper class can be used to mock out Google Test failure reporting 430a39d0a697ff3603e8c100300fda363658e10b23James Zern// so that we can test Google Test or code that builds on Google Test. 440a39d0a697ff3603e8c100300fda363658e10b23James Zern// 450a39d0a697ff3603e8c100300fda363658e10b23James Zern// An object of this class appends a TestPartResult object to the 460a39d0a697ff3603e8c100300fda363658e10b23James Zern// TestPartResultArray object given in the constructor whenever a Google Test 470a39d0a697ff3603e8c100300fda363658e10b23James Zern// failure is reported. It can either intercept only failures that are 480a39d0a697ff3603e8c100300fda363658e10b23James Zern// generated in the same thread that created this object or it can intercept 490a39d0a697ff3603e8c100300fda363658e10b23James Zern// all generated failures. The scope of this mock object can be controlled with 500a39d0a697ff3603e8c100300fda363658e10b23James Zern// the second argument to the two arguments constructor. 510a39d0a697ff3603e8c100300fda363658e10b23James Zernclass GTEST_API_ ScopedFakeTestPartResultReporter 520a39d0a697ff3603e8c100300fda363658e10b23James Zern : public TestPartResultReporterInterface { 530a39d0a697ff3603e8c100300fda363658e10b23James Zern public: 540a39d0a697ff3603e8c100300fda363658e10b23James Zern // The two possible mocking modes of this object. 550a39d0a697ff3603e8c100300fda363658e10b23James Zern enum InterceptMode { 560a39d0a697ff3603e8c100300fda363658e10b23James Zern INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures. 570a39d0a697ff3603e8c100300fda363658e10b23James Zern INTERCEPT_ALL_THREADS // Intercepts all failures. 580a39d0a697ff3603e8c100300fda363658e10b23James Zern }; 590a39d0a697ff3603e8c100300fda363658e10b23James Zern 600a39d0a697ff3603e8c100300fda363658e10b23James Zern // The c'tor sets this object as the test part result reporter used 610a39d0a697ff3603e8c100300fda363658e10b23James Zern // by Google Test. The 'result' parameter specifies where to report the 620a39d0a697ff3603e8c100300fda363658e10b23James Zern // results. This reporter will only catch failures generated in the current 630a39d0a697ff3603e8c100300fda363658e10b23James Zern // thread. DEPRECATED 640a39d0a697ff3603e8c100300fda363658e10b23James Zern explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result); 650a39d0a697ff3603e8c100300fda363658e10b23James Zern 660a39d0a697ff3603e8c100300fda363658e10b23James Zern // Same as above, but you can choose the interception scope of this object. 670a39d0a697ff3603e8c100300fda363658e10b23James Zern ScopedFakeTestPartResultReporter(InterceptMode intercept_mode, 680a39d0a697ff3603e8c100300fda363658e10b23James Zern TestPartResultArray* result); 690a39d0a697ff3603e8c100300fda363658e10b23James Zern 700a39d0a697ff3603e8c100300fda363658e10b23James Zern // The d'tor restores the previous test part result reporter. 710a39d0a697ff3603e8c100300fda363658e10b23James Zern virtual ~ScopedFakeTestPartResultReporter(); 720a39d0a697ff3603e8c100300fda363658e10b23James Zern 730a39d0a697ff3603e8c100300fda363658e10b23James Zern // Appends the TestPartResult object to the TestPartResultArray 740a39d0a697ff3603e8c100300fda363658e10b23James Zern // received in the constructor. 750a39d0a697ff3603e8c100300fda363658e10b23James Zern // 760a39d0a697ff3603e8c100300fda363658e10b23James Zern // This method is from the TestPartResultReporterInterface 770a39d0a697ff3603e8c100300fda363658e10b23James Zern // interface. 780a39d0a697ff3603e8c100300fda363658e10b23James Zern virtual void ReportTestPartResult(const TestPartResult& result); 790a39d0a697ff3603e8c100300fda363658e10b23James Zern private: 800a39d0a697ff3603e8c100300fda363658e10b23James Zern void Init(); 810a39d0a697ff3603e8c100300fda363658e10b23James Zern 820a39d0a697ff3603e8c100300fda363658e10b23James Zern const InterceptMode intercept_mode_; 830a39d0a697ff3603e8c100300fda363658e10b23James Zern TestPartResultReporterInterface* old_reporter_; 840a39d0a697ff3603e8c100300fda363658e10b23James Zern TestPartResultArray* const result_; 850a39d0a697ff3603e8c100300fda363658e10b23James Zern 860a39d0a697ff3603e8c100300fda363658e10b23James Zern GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter); 870a39d0a697ff3603e8c100300fda363658e10b23James Zern}; 880a39d0a697ff3603e8c100300fda363658e10b23James Zern 890a39d0a697ff3603e8c100300fda363658e10b23James Zernnamespace internal { 900a39d0a697ff3603e8c100300fda363658e10b23James Zern 910a39d0a697ff3603e8c100300fda363658e10b23James Zern// A helper class for implementing EXPECT_FATAL_FAILURE() and 920a39d0a697ff3603e8c100300fda363658e10b23James Zern// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given 930a39d0a697ff3603e8c100300fda363658e10b23James Zern// TestPartResultArray contains exactly one failure that has the given 940a39d0a697ff3603e8c100300fda363658e10b23James Zern// type and contains the given substring. If that's not the case, a 950a39d0a697ff3603e8c100300fda363658e10b23James Zern// non-fatal failure will be generated. 960a39d0a697ff3603e8c100300fda363658e10b23James Zernclass GTEST_API_ SingleFailureChecker { 970a39d0a697ff3603e8c100300fda363658e10b23James Zern public: 980a39d0a697ff3603e8c100300fda363658e10b23James Zern // The constructor remembers the arguments. 990a39d0a697ff3603e8c100300fda363658e10b23James Zern SingleFailureChecker(const TestPartResultArray* results, 1000a39d0a697ff3603e8c100300fda363658e10b23James Zern TestPartResult::Type type, 1010a39d0a697ff3603e8c100300fda363658e10b23James Zern const string& substr); 1020a39d0a697ff3603e8c100300fda363658e10b23James Zern ~SingleFailureChecker(); 1030a39d0a697ff3603e8c100300fda363658e10b23James Zern private: 1040a39d0a697ff3603e8c100300fda363658e10b23James Zern const TestPartResultArray* const results_; 1050a39d0a697ff3603e8c100300fda363658e10b23James Zern const TestPartResult::Type type_; 1060a39d0a697ff3603e8c100300fda363658e10b23James Zern const string substr_; 1070a39d0a697ff3603e8c100300fda363658e10b23James Zern 1080a39d0a697ff3603e8c100300fda363658e10b23James Zern GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker); 1090a39d0a697ff3603e8c100300fda363658e10b23James Zern}; 1100a39d0a697ff3603e8c100300fda363658e10b23James Zern 1110a39d0a697ff3603e8c100300fda363658e10b23James Zern} // namespace internal 1120a39d0a697ff3603e8c100300fda363658e10b23James Zern 1130a39d0a697ff3603e8c100300fda363658e10b23James Zern} // namespace testing 1140a39d0a697ff3603e8c100300fda363658e10b23James Zern 1150a39d0a697ff3603e8c100300fda363658e10b23James Zern// A set of macros for testing Google Test assertions or code that's expected 1160a39d0a697ff3603e8c100300fda363658e10b23James Zern// to generate Google Test fatal failures. It verifies that the given 1170a39d0a697ff3603e8c100300fda363658e10b23James Zern// statement will cause exactly one fatal Google Test failure with 'substr' 1180a39d0a697ff3603e8c100300fda363658e10b23James Zern// being part of the failure message. 1190a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1200a39d0a697ff3603e8c100300fda363658e10b23James Zern// There are two different versions of this macro. EXPECT_FATAL_FAILURE only 1210a39d0a697ff3603e8c100300fda363658e10b23James Zern// affects and considers failures generated in the current thread and 1220a39d0a697ff3603e8c100300fda363658e10b23James Zern// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. 1230a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1240a39d0a697ff3603e8c100300fda363658e10b23James Zern// The verification of the assertion is done correctly even when the statement 1250a39d0a697ff3603e8c100300fda363658e10b23James Zern// throws an exception or aborts the current function. 1260a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1270a39d0a697ff3603e8c100300fda363658e10b23James Zern// Known restrictions: 1280a39d0a697ff3603e8c100300fda363658e10b23James Zern// - 'statement' cannot reference local non-static variables or 1290a39d0a697ff3603e8c100300fda363658e10b23James Zern// non-static members of the current object. 1300a39d0a697ff3603e8c100300fda363658e10b23James Zern// - 'statement' cannot return a value. 1310a39d0a697ff3603e8c100300fda363658e10b23James Zern// - You cannot stream a failure message to this macro. 1320a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1330a39d0a697ff3603e8c100300fda363658e10b23James Zern// Note that even though the implementations of the following two 1340a39d0a697ff3603e8c100300fda363658e10b23James Zern// macros are much alike, we cannot refactor them to use a common 1350a39d0a697ff3603e8c100300fda363658e10b23James Zern// helper macro, due to some peculiarity in how the preprocessor 1360a39d0a697ff3603e8c100300fda363658e10b23James Zern// works. The AcceptsMacroThatExpandsToUnprotectedComma test in 1370a39d0a697ff3603e8c100300fda363658e10b23James Zern// gtest_unittest.cc will fail to compile if we do that. 1380a39d0a697ff3603e8c100300fda363658e10b23James Zern#define EXPECT_FATAL_FAILURE(statement, substr) \ 1390a39d0a697ff3603e8c100300fda363658e10b23James Zern do { \ 1400a39d0a697ff3603e8c100300fda363658e10b23James Zern class GTestExpectFatalFailureHelper {\ 1410a39d0a697ff3603e8c100300fda363658e10b23James Zern public:\ 1420a39d0a697ff3603e8c100300fda363658e10b23James Zern static void Execute() { statement; }\ 1430a39d0a697ff3603e8c100300fda363658e10b23James Zern };\ 1440a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::TestPartResultArray gtest_failures;\ 1450a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::internal::SingleFailureChecker gtest_checker(\ 1460a39d0a697ff3603e8c100300fda363658e10b23James Zern >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ 1470a39d0a697ff3603e8c100300fda363658e10b23James Zern {\ 1480a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ 1490a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::ScopedFakeTestPartResultReporter:: \ 1500a39d0a697ff3603e8c100300fda363658e10b23James Zern INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ 1510a39d0a697ff3603e8c100300fda363658e10b23James Zern GTestExpectFatalFailureHelper::Execute();\ 1520a39d0a697ff3603e8c100300fda363658e10b23James Zern }\ 1530a39d0a697ff3603e8c100300fda363658e10b23James Zern } while (::testing::internal::AlwaysFalse()) 1540a39d0a697ff3603e8c100300fda363658e10b23James Zern 1550a39d0a697ff3603e8c100300fda363658e10b23James Zern#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ 1560a39d0a697ff3603e8c100300fda363658e10b23James Zern do { \ 1570a39d0a697ff3603e8c100300fda363658e10b23James Zern class GTestExpectFatalFailureHelper {\ 1580a39d0a697ff3603e8c100300fda363658e10b23James Zern public:\ 1590a39d0a697ff3603e8c100300fda363658e10b23James Zern static void Execute() { statement; }\ 1600a39d0a697ff3603e8c100300fda363658e10b23James Zern };\ 1610a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::TestPartResultArray gtest_failures;\ 1620a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::internal::SingleFailureChecker gtest_checker(\ 1630a39d0a697ff3603e8c100300fda363658e10b23James Zern >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ 1640a39d0a697ff3603e8c100300fda363658e10b23James Zern {\ 1650a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ 1660a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::ScopedFakeTestPartResultReporter:: \ 1670a39d0a697ff3603e8c100300fda363658e10b23James Zern INTERCEPT_ALL_THREADS, >est_failures);\ 1680a39d0a697ff3603e8c100300fda363658e10b23James Zern GTestExpectFatalFailureHelper::Execute();\ 1690a39d0a697ff3603e8c100300fda363658e10b23James Zern }\ 1700a39d0a697ff3603e8c100300fda363658e10b23James Zern } while (::testing::internal::AlwaysFalse()) 1710a39d0a697ff3603e8c100300fda363658e10b23James Zern 1720a39d0a697ff3603e8c100300fda363658e10b23James Zern// A macro for testing Google Test assertions or code that's expected to 1730a39d0a697ff3603e8c100300fda363658e10b23James Zern// generate Google Test non-fatal failures. It asserts that the given 1740a39d0a697ff3603e8c100300fda363658e10b23James Zern// statement will cause exactly one non-fatal Google Test failure with 'substr' 1750a39d0a697ff3603e8c100300fda363658e10b23James Zern// being part of the failure message. 1760a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1770a39d0a697ff3603e8c100300fda363658e10b23James Zern// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only 1780a39d0a697ff3603e8c100300fda363658e10b23James Zern// affects and considers failures generated in the current thread and 1790a39d0a697ff3603e8c100300fda363658e10b23James Zern// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. 1800a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1810a39d0a697ff3603e8c100300fda363658e10b23James Zern// 'statement' is allowed to reference local variables and members of 1820a39d0a697ff3603e8c100300fda363658e10b23James Zern// the current object. 1830a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1840a39d0a697ff3603e8c100300fda363658e10b23James Zern// The verification of the assertion is done correctly even when the statement 1850a39d0a697ff3603e8c100300fda363658e10b23James Zern// throws an exception or aborts the current function. 1860a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1870a39d0a697ff3603e8c100300fda363658e10b23James Zern// Known restrictions: 1880a39d0a697ff3603e8c100300fda363658e10b23James Zern// - You cannot stream a failure message to this macro. 1890a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1900a39d0a697ff3603e8c100300fda363658e10b23James Zern// Note that even though the implementations of the following two 1910a39d0a697ff3603e8c100300fda363658e10b23James Zern// macros are much alike, we cannot refactor them to use a common 1920a39d0a697ff3603e8c100300fda363658e10b23James Zern// helper macro, due to some peculiarity in how the preprocessor 1930a39d0a697ff3603e8c100300fda363658e10b23James Zern// works. If we do that, the code won't compile when the user gives 1940a39d0a697ff3603e8c100300fda363658e10b23James Zern// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that 1950a39d0a697ff3603e8c100300fda363658e10b23James Zern// expands to code containing an unprotected comma. The 1960a39d0a697ff3603e8c100300fda363658e10b23James Zern// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc 1970a39d0a697ff3603e8c100300fda363658e10b23James Zern// catches that. 1980a39d0a697ff3603e8c100300fda363658e10b23James Zern// 1990a39d0a697ff3603e8c100300fda363658e10b23James Zern// For the same reason, we have to write 2000a39d0a697ff3603e8c100300fda363658e10b23James Zern// if (::testing::internal::AlwaysTrue()) { statement; } 2010a39d0a697ff3603e8c100300fda363658e10b23James Zern// instead of 2020a39d0a697ff3603e8c100300fda363658e10b23James Zern// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) 2030a39d0a697ff3603e8c100300fda363658e10b23James Zern// to avoid an MSVC warning on unreachable code. 2040a39d0a697ff3603e8c100300fda363658e10b23James Zern#define EXPECT_NONFATAL_FAILURE(statement, substr) \ 2050a39d0a697ff3603e8c100300fda363658e10b23James Zern do {\ 2060a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::TestPartResultArray gtest_failures;\ 2070a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::internal::SingleFailureChecker gtest_checker(\ 2080a39d0a697ff3603e8c100300fda363658e10b23James Zern >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ 2090a39d0a697ff3603e8c100300fda363658e10b23James Zern (substr));\ 2100a39d0a697ff3603e8c100300fda363658e10b23James Zern {\ 2110a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ 2120a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::ScopedFakeTestPartResultReporter:: \ 2130a39d0a697ff3603e8c100300fda363658e10b23James Zern INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ 2140a39d0a697ff3603e8c100300fda363658e10b23James Zern if (::testing::internal::AlwaysTrue()) { statement; }\ 2150a39d0a697ff3603e8c100300fda363658e10b23James Zern }\ 2160a39d0a697ff3603e8c100300fda363658e10b23James Zern } while (::testing::internal::AlwaysFalse()) 2170a39d0a697ff3603e8c100300fda363658e10b23James Zern 2180a39d0a697ff3603e8c100300fda363658e10b23James Zern#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ 2190a39d0a697ff3603e8c100300fda363658e10b23James Zern do {\ 2200a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::TestPartResultArray gtest_failures;\ 2210a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::internal::SingleFailureChecker gtest_checker(\ 2220a39d0a697ff3603e8c100300fda363658e10b23James Zern >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ 2230a39d0a697ff3603e8c100300fda363658e10b23James Zern (substr));\ 2240a39d0a697ff3603e8c100300fda363658e10b23James Zern {\ 2250a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ 2260a39d0a697ff3603e8c100300fda363658e10b23James Zern ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ 2270a39d0a697ff3603e8c100300fda363658e10b23James Zern >est_failures);\ 2280a39d0a697ff3603e8c100300fda363658e10b23James Zern if (::testing::internal::AlwaysTrue()) { statement; }\ 2290a39d0a697ff3603e8c100300fda363658e10b23James Zern }\ 2300a39d0a697ff3603e8c100300fda363658e10b23James Zern } while (::testing::internal::AlwaysFalse()) 2310a39d0a697ff3603e8c100300fda363658e10b23James Zern 2320a39d0a697ff3603e8c100300fda363658e10b23James Zern#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_ 233