aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/src
diff options
context:
space:
mode:
authorJae Heon Lee <jaeheonlee@google.com>2018-05-07 14:09:37 -0700
committerJae Heon Lee <jaeheonlee@google.com>2018-05-07 14:09:37 -0700
commitec5ad0f8698881ea99b2fcda8c244b876b334afe (patch)
treee3d74401191c8e202cd02c7ca74a53bdbec7654e /googletest/src
parent045e7f9ee4f969ac1a3fe428f79c4b880f0aff43 (diff)
downloadgoogletest-ec5ad0f8698881ea99b2fcda8c244b876b334afe.tar.gz
googletest-ec5ad0f8698881ea99b2fcda8c244b876b334afe.tar.bz2
googletest-ec5ad0f8698881ea99b2fcda8c244b876b334afe.zip
Fix the bug where ad_hoc_test_result() functions of UnitTest and TestCase objects would return failures registered at TestCase and UnitTest scopes, respectively.
Diffstat (limited to 'googletest/src')
-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 73e9bf86..4fcd9b53 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_ != nullptr) {
+ return &current_test_info_->result_;
+ }
+ if (current_test_case_ != nullptr) {
+ return &current_test_case_->ad_hoc_test_result_;
+ }
+ return &ad_hoc_test_result_;
}
// Shuffles all test cases, and the tests within each test case,