umd/external/protobuf-2.6/gtest/fused-src/gtest/gtest-all.cc
bool DeathTestImpl::Passed(bool status_ok) {
  if (!spawned())
    return false;

  const String error_message = GetCapturedStderr();

  bool success = false;
  Message buffer;

  buffer << "Death test: " << statement() << "\n";
  switch (outcome()) {
    case LIVED:
      buffer << "    Result: failed to die.\n"
             << " Error msg: " << error_message;
      break;
    case RETURNED:
      buffer << "    Result: illegal return in test statement.\n"
             << " Error msg: " << error_message;
      break;
    case DIED:
      if (status_ok) {
        const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
        if (matched) {
          success = true;
        } else {
          buffer << "    Result: died but not with expected error.\n"
                 << "  Expected: " << regex()->pattern() << "\n"
                 << "Actual msg: " << error_message;
        }
      } else {
        buffer << "    Result: died but not with expected exit code:\n"
               << "            " << ExitSummary(status()) << "\n";
      }
      break;
    case IN_PROGRESS:
    default:
      GTEST_LOG_(FATAL)
          << "DeathTest::Passed somehow called before conclusion of test";
  }

  DeathTest::set_last_death_test_message(buffer.GetString());
  return success;
}
// Assesses the success or failure of a death test, using both private
// members which have previously been set, and one argument:
//
// Private data members:
//   outcome:  An enumeration describing how the death test
//             concluded: DIED, LIVED, or RETURNED.  The death test fails
//             in the latter two cases.
//   status:   The exit status of the child process. On *nix, it is in the
//             in the format specified by wait(2). On Windows, this is the
//             value supplied to the ExitProcess() API or a numeric code
//             of the exception that terminated the program.
//   regex:    A regular expression object to be applied to
//             the test's captured standard error output; the death test
//             fails if it does not match.
//
// Argument:
//   status_ok: true if exit_status is acceptable in the context of
//              this particular death test, which fails if it is false
//
// Returns true iff all of the above conditions are met.  Otherwise, the
// first failing condition, in the order given above, is the one that is
// reported. Also sets the last death test message string.
Assesses the success or failure of a death test, using both private
members which have previously been set, and one argument.

Private data members:
outcome:  An enumeration describing how the death test
concluded: DIED, LIVED, or RETURNED.  The death test fails
in the latter two cases.
status:   The exit status of the child process. On *nix, it is in the
in the format specified by wait(2). On Windows, this is the
value supplied to the ExitProcess() API or a numeric code
of the exception that terminated the program.
regex:    A regular expression object to be applied to
the test's captured standard error output; the death test
fails if it does not match.

true if exit_status is acceptable in the context of
this particular death test, which fails if it is false

Returns true iff all of the above conditions are met.  Otherwise, the
first failing condition, in the order given above, is the one that is
reported. Also sets the last death test message string.
Assesses the success or failure of a death test using both private members which have previously been set and one argument . Private data members : outcome : An enumeration describing how the death test concluded : DIED LIVED or RETURNED . The death test fails in the latter two cases . status : The exit status of the child process . On * nix it is in the in the format specified by wait ( 2 ) . On Windows this is the value supplied to the ExitProcess () API or a numeric code of the exception that terminated the program . regex : A regular expression object to be applied to the test ' s captured standard error output ; the death test fails if it does not match . true if exit_status is acceptable in the context of this particular death test which fails if it is false Returns true iff all of the above conditions are met . Otherwise the first failing condition in the order given above is the one that is reported . Also sets the last death test message string .
bool DeathTestImpl::Passed(bool status_ok) {
  if (!spawned())
    return false;
  const String error_message = GetCapturedStderr();
  bool success = false;
  Message buffer;
  buffer << "Death test: " << statement() << "\n";
  switch (outcome()) {
    case LIVED:
      buffer << "    Result: failed to die.\n"
             << " Error msg: " << error_message;
      break;
    case RETURNED:
      buffer << "    Result: illegal return in test statement.\n"
             << " Error msg: " << error_message;
      break;
    case DIED:
      if (status_ok) {
        const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
        if (matched) {
          success = true;
        } else {
          buffer << "    Result: died but not with expected error.\n"
                 << "  Expected: " << regex()->pattern() << "\n"
                 << "Actual msg: " << error_message;
        }
      } else {
        buffer << "    Result: died but not with expected exit code:\n"
               << "            " << ExitSummary(status()) << "\n";
      }
      break;
    case IN_PROGRESS:
    default:
      GTEST_LOG_(FATAL)
          << "DeathTest::Passed somehow called before conclusion of test";
  }
  DeathTest::set_last_death_test_message(buffer.GetString());
  return success;
}
bool DeathTestImpl :: Passed ( bool status_ok ) { if ( ! spawned ( ) ) return false ; const String error_message = GetCapturedStderr ( ) ; bool success = false ; Message buffer ; buffer << " " << statement ( ) << " \n " ; switch ( outcome ( ) ) { case LIVED : buffer << " \n " << " " << error_message ; break ; case RETURNED : buffer << " \n " << " " << error_message ; break ; case DIED : if ( status_ok ) { const bool matched = RE :: PartialMatch ( error_message . c_str ( ) , * regex ( ) ) ; if ( matched ) { success = true ; } else { buffer << " \n " << " " << regex ( ) -> pattern ( ) << " \n " << " " << error_message ; } } else { buffer << " \n " << " " << ExitSummary ( status ( ) ) << " \n " ; } break ; case IN_PROGRESS : default : GTEST_LOG_ ( FATAL ) << " " ; } DeathTest :: set_last_death_test_message ( buffer . GetString ( ) ) ; return success ; }
Assesses the success or failure of a death test, using both private
members which have previously been set, and one argument:
Assesses the success or failure of a death test using both private members which have previously been set and one argument :