mirror of
https://github.com/google/googletest.git
synced 2024-12-27 10:11:03 +08:00
Internal Code Change
PiperOrigin-RevId: 518810140 Change-Id: Id3f9471f827894761080bc9199b0a092dc829b5f
This commit is contained in:
parent
5fce13091d
commit
6f01e3dc12
@ -44,7 +44,7 @@ namespace testing {
|
||||
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
||||
AssertionResult::AssertionResult(const AssertionResult& other)
|
||||
: success_(other.success_),
|
||||
message_(other.message_.get() != nullptr
|
||||
message_(other.message_ != nullptr
|
||||
? new ::std::string(*other.message_)
|
||||
: static_cast< ::std::string*>(nullptr)) {}
|
||||
|
||||
@ -58,7 +58,7 @@ void AssertionResult::swap(AssertionResult& other) {
|
||||
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
|
||||
AssertionResult AssertionResult::operator!() const {
|
||||
AssertionResult negation(!success_);
|
||||
if (message_.get() != nullptr) negation << *message_;
|
||||
if (message_ != nullptr) negation << *message_;
|
||||
return negation;
|
||||
}
|
||||
|
||||
|
@ -1524,7 +1524,7 @@ static int GetStatusFileDescriptor(unsigned int parent_process_id,
|
||||
// initialized from the GTEST_FLAG(internal_run_death_test) flag if
|
||||
// the flag is specified; otherwise returns NULL.
|
||||
InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
|
||||
if (GTEST_FLAG_GET(internal_run_death_test) == "") return nullptr;
|
||||
if (GTEST_FLAG_GET(internal_run_death_test).empty()) return nullptr;
|
||||
|
||||
// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we
|
||||
// can use it here.
|
||||
|
@ -37,8 +37,6 @@
|
||||
|
||||
namespace testing {
|
||||
|
||||
using internal::GetUnitTestImpl;
|
||||
|
||||
// Gets the summary of the failure message by omitting the stack trace
|
||||
// in it.
|
||||
std::string TestPartResult::ExtractSummary(const char* message) {
|
||||
|
@ -90,7 +90,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
|
||||
}
|
||||
|
||||
const std::string& errors_str = errors.GetString();
|
||||
if (errors_str != "") {
|
||||
if (!errors_str.empty()) {
|
||||
fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
|
||||
errors_str.c_str());
|
||||
fflush(stderr);
|
||||
|
@ -408,7 +408,7 @@ uint32_t Random::Generate(uint32_t range) {
|
||||
// GTestIsInitialized() returns true if and only if the user has initialized
|
||||
// Google Test. Useful for catching the user mistake of not initializing
|
||||
// Google Test before calling RUN_ALL_TESTS().
|
||||
static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
|
||||
static bool GTestIsInitialized() { return !GetArgvs().empty(); }
|
||||
|
||||
// Iterates over a vector of TestSuites, keeping a running sum of the
|
||||
// results of calling a given int-returning method on each.
|
||||
@ -5306,7 +5306,7 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
|
||||
msg << message;
|
||||
|
||||
internal::MutexLock lock(&mutex_);
|
||||
if (impl_->gtest_trace_stack().size() > 0) {
|
||||
if (!impl_->gtest_trace_stack().empty()) {
|
||||
msg << "\n" << GTEST_NAME_ << " trace:";
|
||||
|
||||
for (size_t i = impl_->gtest_trace_stack().size(); i > 0; --i) {
|
||||
@ -5606,7 +5606,7 @@ void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
|
||||
// Disables event forwarding if the control is currently in a death test
|
||||
// subprocess. Must not be called before InitGoogleTest.
|
||||
void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
|
||||
if (internal_run_death_test_flag_.get() != nullptr)
|
||||
if (internal_run_death_test_flag_ != nullptr)
|
||||
listeners()->SuppressEventForwarding();
|
||||
}
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
@ -5622,7 +5622,7 @@ void UnitTestImpl::ConfigureXmlOutput() {
|
||||
} else if (output_format == "json") {
|
||||
listeners()->SetDefaultXmlGenerator(new JsonUnitTestResultPrinter(
|
||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
|
||||
} else if (output_format != "") {
|
||||
} else if (!output_format.empty()) {
|
||||
GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \""
|
||||
<< output_format << "\" ignored.";
|
||||
}
|
||||
@ -5804,8 +5804,7 @@ bool UnitTestImpl::RunAllTests() {
|
||||
bool in_subprocess_for_death_test = false;
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
in_subprocess_for_death_test =
|
||||
(internal_run_death_test_flag_.get() != nullptr);
|
||||
in_subprocess_for_death_test = (internal_run_death_test_flag_ != nullptr);
|
||||
#if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
|
||||
if (in_subprocess_for_death_test) {
|
||||
GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_();
|
||||
|
Loading…
x
Reference in New Issue
Block a user