diff options
author | Alyssa Wilk <alyssar@chromium.org> | 2017-08-16 16:43:26 (GMT) |
---|---|---|
committer | Alyssa Wilk <alyssar@chromium.org> | 2017-08-16 16:43:26 (GMT) |
commit | a2803bc37dafdaad05b335e64a83aff03096a4ba (patch) | |
tree | dd903a9bd55d595a9b12f6d9959666377a266111 /googlemock/src/gmock-spec-builders.cc | |
parent | 6e1970e2376c14bf658eb88f655a054030353f9f (diff) | |
download | googletest-a2803bc37dafdaad05b335e64a83aff03096a4ba.zip googletest-a2803bc37dafdaad05b335e64a83aff03096a4ba.tar.gz googletest-a2803bc37dafdaad05b335e64a83aff03096a4ba.tar.bz2 |
Handling invalid flag values
Diffstat (limited to 'googlemock/src/gmock-spec-builders.cc')
-rw-r--r-- | googlemock/src/gmock-spec-builders.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index 1fc8d98..a725d18 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -508,6 +508,13 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked() return expectations_met; } +CallReaction intToCallReaction(int mock_behavior) { + if (mock_behavior >= kAllow && mock_behavior <= kFail) { + return static_cast<internal::CallReaction>(mock_behavior); + } + return kWarn; +} + } // namespace internal // Class Mock. @@ -648,7 +655,7 @@ internal::CallReaction Mock::GetReactionOnUninterestingCalls( GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { internal::MutexLock l(&internal::g_gmock_mutex); return (g_uninteresting_call_reaction.count(mock_obj) == 0) ? - static_cast<internal::CallReaction>(GMOCK_FLAG(default_mock_behavior)) : + internal::intToCallReaction(GMOCK_FLAG(default_mock_behavior)) : g_uninteresting_call_reaction[mock_obj]; } |