Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
6f01e3dc
Commit
6f01e3dc
authored
Mar 23, 2023
by
Abseil Team
Committed by
Copybara-Service
Mar 23, 2023
Browse files
Internal Code Change
PiperOrigin-RevId: 518810140 Change-Id: Id3f9471f827894761080bc9199b0a092dc829b5f
parent
5fce1309
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
12 deletions
+9
-12
googletest/src/gtest-assertion-result.cc
googletest/src/gtest-assertion-result.cc
+2
-2
googletest/src/gtest-death-test.cc
googletest/src/gtest-death-test.cc
+1
-1
googletest/src/gtest-test-part.cc
googletest/src/gtest-test-part.cc
+0
-2
googletest/src/gtest-typed-test.cc
googletest/src/gtest-typed-test.cc
+1
-1
googletest/src/gtest.cc
googletest/src/gtest.cc
+5
-6
No files found.
googletest/src/gtest-assertion-result.cc
View file @
6f01e3dc
...
@@ -44,7 +44,7 @@ namespace testing {
...
@@ -44,7 +44,7 @@ namespace testing {
// Used in EXPECT_TRUE/FALSE(assertion_result).
// Used in EXPECT_TRUE/FALSE(assertion_result).
AssertionResult
::
AssertionResult
(
const
AssertionResult
&
other
)
AssertionResult
::
AssertionResult
(
const
AssertionResult
&
other
)
:
success_
(
other
.
success_
),
:
success_
(
other
.
success_
),
message_
(
other
.
message_
.
get
()
!=
nullptr
message_
(
other
.
message_
!=
nullptr
?
new
::
std
::
string
(
*
other
.
message_
)
?
new
::
std
::
string
(
*
other
.
message_
)
:
static_cast
<
::
std
::
string
*>
(
nullptr
))
{}
:
static_cast
<
::
std
::
string
*>
(
nullptr
))
{}
...
@@ -58,7 +58,7 @@ void AssertionResult::swap(AssertionResult& other) {
...
@@ -58,7 +58,7 @@ void AssertionResult::swap(AssertionResult& other) {
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
AssertionResult
AssertionResult
::
operator
!
()
const
{
AssertionResult
AssertionResult
::
operator
!
()
const
{
AssertionResult
negation
(
!
success_
);
AssertionResult
negation
(
!
success_
);
if
(
message_
.
get
()
!=
nullptr
)
negation
<<
*
message_
;
if
(
message_
!=
nullptr
)
negation
<<
*
message_
;
return
negation
;
return
negation
;
}
}
...
...
googletest/src/gtest-death-test.cc
View file @
6f01e3dc
...
@@ -1524,7 +1524,7 @@ static int GetStatusFileDescriptor(unsigned int parent_process_id,
...
@@ -1524,7 +1524,7 @@ static int GetStatusFileDescriptor(unsigned int parent_process_id,
// initialized from the GTEST_FLAG(internal_run_death_test) flag if
// initialized from the GTEST_FLAG(internal_run_death_test) flag if
// the flag is specified; otherwise returns NULL.
// the flag is specified; otherwise returns NULL.
InternalRunDeathTestFlag
*
ParseInternalRunDeathTestFlag
()
{
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
// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we
// can use it here.
// can use it here.
...
...
googletest/src/gtest-test-part.cc
View file @
6f01e3dc
...
@@ -37,8 +37,6 @@
...
@@ -37,8 +37,6 @@
namespace
testing
{
namespace
testing
{
using
internal
::
GetUnitTestImpl
;
// Gets the summary of the failure message by omitting the stack trace
// Gets the summary of the failure message by omitting the stack trace
// in it.
// in it.
std
::
string
TestPartResult
::
ExtractSummary
(
const
char
*
message
)
{
std
::
string
TestPartResult
::
ExtractSummary
(
const
char
*
message
)
{
...
...
googletest/src/gtest-typed-test.cc
View file @
6f01e3dc
...
@@ -90,7 +90,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
...
@@ -90,7 +90,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
}
}
const
std
::
string
&
errors_str
=
errors
.
GetString
();
const
std
::
string
&
errors_str
=
errors
.
GetString
();
if
(
errors_str
!=
""
)
{
if
(
!
errors_str
.
empty
()
)
{
fprintf
(
stderr
,
"%s %s"
,
FormatFileLocation
(
file
,
line
).
c_str
(),
fprintf
(
stderr
,
"%s %s"
,
FormatFileLocation
(
file
,
line
).
c_str
(),
errors_str
.
c_str
());
errors_str
.
c_str
());
fflush
(
stderr
);
fflush
(
stderr
);
...
...
googletest/src/gtest.cc
View file @
6f01e3dc
...
@@ -408,7 +408,7 @@ uint32_t Random::Generate(uint32_t range) {
...
@@ -408,7 +408,7 @@ uint32_t Random::Generate(uint32_t range) {
// GTestIsInitialized() returns true if and only if the user has initialized
// GTestIsInitialized() returns true if and only if the user has initialized
// Google Test. Useful for catching the user mistake of not initializing
// Google Test. Useful for catching the user mistake of not initializing
// Google Test before calling RUN_ALL_TESTS().
// 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
// Iterates over a vector of TestSuites, keeping a running sum of the
// results of calling a given int-returning method on each.
// results of calling a given int-returning method on each.
...
@@ -5306,7 +5306,7 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
...
@@ -5306,7 +5306,7 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
msg
<<
message
;
msg
<<
message
;
internal
::
MutexLock
lock
(
&
mutex_
);
internal
::
MutexLock
lock
(
&
mutex_
);
if
(
impl_
->
gtest_trace_stack
().
size
()
>
0
)
{
if
(
!
impl_
->
gtest_trace_stack
().
empty
()
)
{
msg
<<
"
\n
"
<<
GTEST_NAME_
<<
" trace:"
;
msg
<<
"
\n
"
<<
GTEST_NAME_
<<
" trace:"
;
for
(
size_t
i
=
impl_
->
gtest_trace_stack
().
size
();
i
>
0
;
--
i
)
{
for
(
size_t
i
=
impl_
->
gtest_trace_stack
().
size
();
i
>
0
;
--
i
)
{
...
@@ -5606,7 +5606,7 @@ void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
...
@@ -5606,7 +5606,7 @@ void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
// Disables event forwarding if the control is currently in a death test
// Disables event forwarding if the control is currently in a death test
// subprocess. Must not be called before InitGoogleTest.
// subprocess. Must not be called before InitGoogleTest.
void
UnitTestImpl
::
SuppressTestEventsIfInSubprocess
()
{
void
UnitTestImpl
::
SuppressTestEventsIfInSubprocess
()
{
if
(
internal_run_death_test_flag_
.
get
()
!=
nullptr
)
if
(
internal_run_death_test_flag_
!=
nullptr
)
listeners
()
->
SuppressEventForwarding
();
listeners
()
->
SuppressEventForwarding
();
}
}
#endif // GTEST_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
...
@@ -5622,7 +5622,7 @@ void UnitTestImpl::ConfigureXmlOutput() {
...
@@ -5622,7 +5622,7 @@ void UnitTestImpl::ConfigureXmlOutput() {
}
else
if
(
output_format
==
"json"
)
{
}
else
if
(
output_format
==
"json"
)
{
listeners
()
->
SetDefaultXmlGenerator
(
new
JsonUnitTestResultPrinter
(
listeners
()
->
SetDefaultXmlGenerator
(
new
JsonUnitTestResultPrinter
(
UnitTestOptions
::
GetAbsolutePathToOutputFile
().
c_str
()));
UnitTestOptions
::
GetAbsolutePathToOutputFile
().
c_str
()));
}
else
if
(
output_format
!=
""
)
{
}
else
if
(
!
output_format
.
empty
()
)
{
GTEST_LOG_
(
WARNING
)
<<
"WARNING: unrecognized output format
\"
"
GTEST_LOG_
(
WARNING
)
<<
"WARNING: unrecognized output format
\"
"
<<
output_format
<<
"
\"
ignored."
;
<<
output_format
<<
"
\"
ignored."
;
}
}
...
@@ -5804,8 +5804,7 @@ bool UnitTestImpl::RunAllTests() {
...
@@ -5804,8 +5804,7 @@ bool UnitTestImpl::RunAllTests() {
bool
in_subprocess_for_death_test
=
false
;
bool
in_subprocess_for_death_test
=
false
;
#ifdef GTEST_HAS_DEATH_TEST
#ifdef GTEST_HAS_DEATH_TEST
in_subprocess_for_death_test
=
in_subprocess_for_death_test
=
(
internal_run_death_test_flag_
!=
nullptr
);
(
internal_run_death_test_flag_
.
get
()
!=
nullptr
);
#if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
#if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
if
(
in_subprocess_for_death_test
)
{
if
(
in_subprocess_for_death_test
)
{
GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_
();
GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment