Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
08d5b1f3
Unverified
Commit
08d5b1f3
authored
May 11, 2018
by
Gennadiy Civil
Committed by
GitHub
May 11, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1597 from jaeheonlee/master
Fix a bug with ad_hoc_test_result() functions of UnitTest and TestCase classes
parents
045e7f9e
18abd8f5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
gtest.cc
googletest/src/gtest.cc
+8
-4
gtest_unittest.cc
googletest/test/gtest_unittest.cc
+22
-0
No files found.
googletest/src/gtest.cc
View file @
08d5b1f3
...
@@ -5340,11 +5340,15 @@ OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
...
@@ -5340,11 +5340,15 @@ OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
return
os_stack_trace_getter_
;
return
os_stack_trace_getter_
;
}
}
// Returns the TestResult for the test that's currently running, or
// Returns the most specific TestResult currently running.
// the TestResult for the ad hoc test if no test is running.
TestResult
*
UnitTestImpl
::
current_test_result
()
{
TestResult
*
UnitTestImpl
::
current_test_result
()
{
return
current_test_info_
?
if
(
current_test_info_
!=
NULL
)
{
&
(
current_test_info_
->
result_
)
:
&
ad_hoc_test_result_
;
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,
// Shuffles all test cases, and the tests within each test case,
...
...
googletest/test/gtest_unittest.cc
View file @
08d5b1f3
...
@@ -7748,3 +7748,25 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
...
@@ -7748,3 +7748,25 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
EXPECT_FALSE
(
SkipPrefix
(
"world!"
,
&
p
));
EXPECT_FALSE
(
SkipPrefix
(
"world!"
,
&
p
));
EXPECT_EQ
(
str
,
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