summaryrefslogtreecommitdiffstats
path: root/googletest/src/gtest.cc
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2018-05-11 13:05:24 (GMT)
committerGitHub <noreply@github.com>2018-05-11 13:05:24 (GMT)
commit08d5b1f33af8c18785fb8ca02792b5fac81e248f (patch)
tree1be2912bc49bc7d11ae1e9be65719ac700de413d /googletest/src/gtest.cc
parent045e7f9ee4f969ac1a3fe428f79c4b880f0aff43 (diff)
parent18abd8f51281461fe4f29cc0e7c18e9ed0888c9f (diff)
downloadgoogletest-08d5b1f33af8c18785fb8ca02792b5fac81e248f.zip
googletest-08d5b1f33af8c18785fb8ca02792b5fac81e248f.tar.gz
googletest-08d5b1f33af8c18785fb8ca02792b5fac81e248f.tar.bz2
Merge pull request #1597 from jaeheonlee/master
Fix a bug with ad_hoc_test_result() functions of UnitTest and TestCase classes
Diffstat (limited to 'googletest/src/gtest.cc')
-rw-r--r--googletest/src/gtest.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 73e9bf8..1b2aad2 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -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,