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
89286a4c
Unverified
Commit
89286a4c
authored
May 21, 2018
by
James Dennett
Committed by
GitHub
May 21, 2018
Browse files
Merge branch 'master' into StdLibVersioning
parents
54e331b8
08d5b1f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
googletest/src/gtest.cc
googletest/src/gtest.cc
+8
-4
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+22
-0
No files found.
googletest/src/gtest.cc
View file @
89286a4c
...
...
@@ -5340,11 +5340,15 @@ OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
return
os_stack_trace_getter_
;
}
// Returns the TestResult for the test that's currently running, or
// the TestResult for the ad hoc test if no test is running.
// Returns the most specific TestResult currently running.
TestResult
*
UnitTestImpl
::
current_test_result
()
{
return
current_test_info_
?
&
(
current_test_info_
->
result_
)
:
&
ad_hoc_test_result_
;
if
(
current_test_info_
!=
NULL
)
{
return
&
current_test_info_
->
result_
;
}
if
(
current_test_case_
!=
NULL
)
{
return
&
current_test_case_
->
ad_hoc_test_result_
;
}
return
&
ad_hoc_test_result_
;
}
// Shuffles all test cases, and the tests within each test case,
...
...
googletest/test/gtest_unittest.cc
View file @
89286a4c
...
...
@@ -7773,3 +7773,25 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
EXPECT_FALSE
(
SkipPrefix
(
"world!"
,
&
p
));
EXPECT_EQ
(
str
,
p
);
}
// Tests ad_hoc_test_result().
class
AdHocTestResultTest
:
public
testing
::
Test
{
protected:
static
void
SetUpTestCase
()
{
FAIL
()
<<
"A failure happened inside SetUpTestCase()."
;
}
};
TEST_F
(
AdHocTestResultTest
,
AdHocTestResultForTestCaseShowsFailure
)
{
const
testing
::
TestResult
&
test_result
=
testing
::
UnitTest
::
GetInstance
()
->
current_test_case
()
->
ad_hoc_test_result
();
EXPECT_TRUE
(
test_result
.
Failed
());
}
TEST_F
(
AdHocTestResultTest
,
AdHocTestResultTestForUnitTestDoesNotShowFailure
)
{
const
testing
::
TestResult
&
test_result
=
testing
::
UnitTest
::
GetInstance
()
->
ad_hoc_test_result
();
EXPECT_FALSE
(
test_result
.
Failed
());
}
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