diff options
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/docs/cheat_sheet.md | 6 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 3 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 21 | ||||
-rw-r--r-- | googlemock/scripts/README.md | 2 |
4 files changed, 13 insertions, 19 deletions
diff --git a/googlemock/docs/cheat_sheet.md b/googlemock/docs/cheat_sheet.md index f6e7349..b425e0a 100644 --- a/googlemock/docs/cheat_sheet.md +++ b/googlemock/docs/cheat_sheet.md @@ -278,6 +278,12 @@ copy constructor, try wrap it in `ByRef()`, e.g. `Eq(ByRef(non_copyable_value))`. If you do that, make sure `non_copyable_value` is not changed afterwards, or the meaning of your matcher will be changed. +`IsTrue` and `IsFalse` are useful when you need to use a matcher, or for types +that can be explicitly converted to Boolean, but are not implicitly converted to +Boolean. In other cases, you can use the basic +[`EXPECT_TRUE` and `EXPECT_FALSE`](../../googletest/docs/primer#basic-assertions) +assertions. + #### Floating-Point Matchers {#FpMatchers} <!-- mdformat off(no multiline tables) --> diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index dcdbab5..c08d97b 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -916,7 +916,8 @@ struct WithArgsAction { // We use the conversion operator to detect the signature of the inner Action. template <typename R, typename... Args> operator Action<R(Args...)>() const { // NOLINT - Action<R(typename std::tuple_element<I, std::tuple<Args...>>::type...)> + using TupleType = std::tuple<Args...>; + Action<R(typename std::tuple_element<I, TupleType>::type...)> converted(action); return [converted](Args... args) -> R { diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 99f1774..317d2c9 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -4044,11 +4044,7 @@ template <typename Container> inline PolymorphicMatcher<internal::ContainerEqMatcher< typename std::remove_const<Container>::type>> ContainerEq(const Container& rhs) { - // This following line is for working around a bug in MSVC 8.0, - // which causes Container to be a const type sometimes. - typedef typename std::remove_const<Container>::type RawContainer; - return MakePolymorphicMatcher( - internal::ContainerEqMatcher<RawContainer>(rhs)); + return MakePolymorphicMatcher(internal::ContainerEqMatcher<Container>(rhs)); } // Returns a matcher that matches a container that, when sorted using @@ -4081,12 +4077,8 @@ template <typename TupleMatcher, typename Container> inline internal::PointwiseMatcher<TupleMatcher, typename std::remove_const<Container>::type> Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) { - // This following line is for working around a bug in MSVC 8.0, - // which causes Container to be a const type sometimes (e.g. when - // rhs is a const int[]).. - typedef typename std::remove_const<Container>::type RawContainer; - return internal::PointwiseMatcher<TupleMatcher, RawContainer>( - tuple_matcher, rhs); + return internal::PointwiseMatcher<TupleMatcher, Container>(tuple_matcher, + rhs); } @@ -4117,14 +4109,9 @@ inline internal::UnorderedElementsAreArrayMatcher< typename std::remove_const<RhsContainer>::type>::type::value_type>> UnorderedPointwise(const Tuple2Matcher& tuple2_matcher, const RhsContainer& rhs_container) { - // This following line is for working around a bug in MSVC 8.0, - // which causes RhsContainer to be a const type sometimes (e.g. when - // rhs_container is a const int[]). - typedef typename std::remove_const<RhsContainer>::type RawRhsContainer; - // RhsView allows the same code to handle RhsContainer being a // STL-style container and it being a native C-style array. - typedef typename internal::StlContainerView<RawRhsContainer> RhsView; + typedef typename internal::StlContainerView<RhsContainer> RhsView; typedef typename RhsView::type RhsStlContainer; typedef typename RhsStlContainer::value_type Second; const RhsStlContainer& rhs_stl_container = diff --git a/googlemock/scripts/README.md b/googlemock/scripts/README.md index fa359fe..a3301e5 100644 --- a/googlemock/scripts/README.md +++ b/googlemock/scripts/README.md @@ -1,5 +1,5 @@ # Please Note: Files in this directory are no longer supported by the maintainers. They -represent mosty historical artifacts and supported by the community only. There +represent mostly historical artifacts and supported by the community only. There is no guarantee whatsoever that these scripts still work. |