umd/external/protobuf-2.6/gtest/fused-src/gtest/gtest-all.cc
void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
                                 const char* file_name,
                                 int line_number,
                                 const internal::String& message,
                                 const internal::String& os_stack_trace) {
  Message msg;
  msg << message;

  internal::MutexLock lock(&mutex_);
  if (impl_->gtest_trace_stack().size() > 0) {
    msg << "\n" << GTEST_NAME_ << " trace:";

    for (int i = static_cast<int>(impl_->gtest_trace_stack().size());
         i > 0; --i) {
      const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1];
      msg << "\n" << internal::FormatFileLocation(trace.file, trace.line)
          << " " << trace.message;
    }
  }

  if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
    msg << internal::kStackTraceMarker << os_stack_trace;
  }

  const TestPartResult result =
    TestPartResult(result_type, file_name, line_number,
                   msg.GetString().c_str());
  impl_->GetTestPartResultReporterForCurrentThread()->
      ReportTestPartResult(result);

  if (result_type != TestPartResult::kSuccess) {
    // gtest_break_on_failure takes precedence over
    // gtest_throw_on_failure.  This allows a user to set the latter
    // in the code (perhaps in order to use Google Test assertions
    // with another testing framework) and specify the former on the
    // command line for debugging.
    if (GTEST_FLAG(break_on_failure)) {
#if GTEST_OS_WINDOWS
      // Using DebugBreak on Windows allows gtest to still break into a debugger
      // when a failure happens and both the --gtest_break_on_failure and
      // the --gtest_catch_exceptions flags are specified.
      DebugBreak();
#else
      *static_cast<int*>(NULL) = 1;
#endif  // GTEST_OS_WINDOWS
    } else if (GTEST_FLAG(throw_on_failure)) {
#if GTEST_HAS_EXCEPTIONS
      throw GoogleTestFailureException(result);
#else
      // We cannot call abort() as it generates a pop-up in debug mode
      // that cannot be suppressed in VC 7.1 or below.
      exit(1);
#endif
    }
  }
}
// Adds a TestPartResult to the current TestResult object.  All Google Test
// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
// this to report their results.  The user code should use the
// assertion macros instead of calling this directly.
// L < mutex_
Adds a TestPartResult to the current TestResult object.  All Google Test
assertion macros  eventually call
this to report their results.  The user code should use the
assertion macros instead of calling this directly.
L < mutex_
Adds a TestPartResult to the current TestResult object . All Google Test assertion macros eventually call this to report their results . The user code should use the assertion macros instead of calling this directly . L < mutex_
void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
                                 const char* file_name,
                                 int line_number,
                                 const internal::String& message,
                                 const internal::String& os_stack_trace) {
  Message msg;
  msg << message;
  internal::MutexLock lock(&mutex_);
  if (impl_->gtest_trace_stack().size() > 0) {
    msg << "\n" << GTEST_NAME_ << " trace:";
    for (int i = static_cast<int>(impl_->gtest_trace_stack().size());
         i > 0; --i) {
      const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1];
      msg << "\n" << internal::FormatFileLocation(trace.file, trace.line)
          << " " << trace.message;
    }
  }
  if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
    msg << internal::kStackTraceMarker << os_stack_trace;
  }
  const TestPartResult result =
    TestPartResult(result_type, file_name, line_number,
                   msg.GetString().c_str());
  impl_->GetTestPartResultReporterForCurrentThread()->
      ReportTestPartResult(result);
  if (result_type != TestPartResult::kSuccess) {
    if (GTEST_FLAG(break_on_failure)) {
#if GTEST_OS_WINDOWS
      DebugBreak();
#else
      *static_cast<int*>(NULL) = 1;
#endif  
    } else if (GTEST_FLAG(throw_on_failure)) {
#if GTEST_HAS_EXCEPTIONS
      throw GoogleTestFailureException(result);
#else
      exit(1);
#endif
    }
  }
}
void UnitTest :: AddTestPartResult ( TestPartResult :: Type result_type , const char * file_name , int line_number , const internal :: String & message , const internal :: String & os_stack_trace ) { Message msg ; msg << message ; internal :: MutexLock lock ( & mutex_ ) ; if ( impl_ -> gtest_trace_stack ( ) . size ( ) > 0 ) { msg << " \n " << GTEST_NAME_ << " " ; for ( int i = static_cast < int > ( impl_ -> gtest_trace_stack ( ) . size ( ) ) ; i > 0 ; -- i ) { const internal :: TraceInfo & trace = impl_ -> gtest_trace_stack ( ) [ i - 1 ] ; msg << " \n " << internal :: FormatFileLocation ( trace . file , trace . line ) << " " << trace . message ; } } if ( os_stack_trace . c_str ( ) != NULL && ! os_stack_trace . empty ( ) ) { msg << internal :: kStackTraceMarker << os_stack_trace ; } const TestPartResult result = TestPartResult ( result_type , file_name , line_number , msg . GetString ( ) . c_str ( ) ) ; impl_ -> GetTestPartResultReporterForCurrentThread ( ) -> ReportTestPartResult ( result ) ; if ( result_type != TestPartResult :: kSuccess ) { if ( GTEST_FLAG ( break_on_failure ) ) { #if GTEST_OS_WINDOWS DebugBreak ( ) ; #else * static_cast < int * > ( NULL ) = 1 ; #endif } else if ( GTEST_FLAG ( throw_on_failure ) ) { #if GTEST_HAS_EXCEPTIONS throw GoogleTestFailureException ( result ) ; #else exit ( 1 ) ; #endif } } }
Adds a TestPartResult to the current TestResult object.
Adds a TestPartResult to the current TestResult object .
// gtest_break_on_failure takes precedence over // gtest_throw_on_failure.  This allows a user to set the latter // in the code (perhaps in order to use Google Test assertions // with another testing framework) and specify the former on the // command line for debugging. // Using DebugBreak on Windows allows gtest to still break into a debugger // when a failure happens and both the --gtest_break_on_failure and // the --gtest_catch_exceptions flags are specified. // GTEST_OS_WINDOWS // We cannot call abort() as it generates a pop-up in debug mode // that cannot be suppressed in VC 7.1 or below.