aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
Diffstat (limited to 'googlemock')
-rw-r--r--googlemock/CMakeLists.txt11
-rw-r--r--googlemock/docs/cheat_sheet.md5
-rw-r--r--googlemock/docs/cook_book.md2
-rw-r--r--googlemock/docs/for_dummies.md7
-rw-r--r--googlemock/include/gmock/gmock-actions.h8
-rw-r--r--googlemock/include/gmock/gmock-matchers.h69
-rw-r--r--googlemock/include/gmock/gmock-more-actions.h2
-rw-r--r--googlemock/include/gmock/gmock-spec-builders.h6
-rw-r--r--googlemock/include/gmock/internal/gmock-internal-utils.h75
-rw-r--r--googlemock/test/BUILD.bazel3
-rw-r--r--googlemock/test/gmock-actions_test.cc8
-rw-r--r--googlemock/test/gmock-internal-utils_test.cc39
-rw-r--r--googlemock/test/gmock-matchers_test.cc2
13 files changed, 88 insertions, 149 deletions
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
index f75ec45d..d32b70b5 100644
--- a/googlemock/CMakeLists.txt
+++ b/googlemock/CMakeLists.txt
@@ -150,6 +150,14 @@ $env:Path = \"$project_bin;$env:Path\"
& $args")
endif()
+ if (MINGW OR CYGWIN)
+ if (CMAKE_VERSION VERSION_LESS "2.8.12")
+ add_compile_options("-Wa,-mbig-obj")
+ else()
+ add_definitions("-Wa,-mbig-obj")
+ endif()
+ endif()
+
############################################################
# C++ tests built with standard compiler flags.
@@ -162,9 +170,6 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_test(gmock-generated-matchers_test gmock_main)
cxx_test(gmock-internal-utils_test gmock_main)
cxx_test(gmock-matchers_test gmock_main)
- if (MINGW OR CYGWIN)
- target_compile_options(gmock-matchers_test PRIVATE "-Wa,-mbig-obj")
- endif()
cxx_test(gmock-more-actions_test gmock_main)
cxx_test(gmock-nice-strict_test gmock_main)
cxx_test(gmock-port_test gmock_main)
diff --git a/googlemock/docs/cheat_sheet.md b/googlemock/docs/cheat_sheet.md
index 37c808f5..239a4c6d 100644
--- a/googlemock/docs/cheat_sheet.md
+++ b/googlemock/docs/cheat_sheet.md
@@ -312,8 +312,9 @@ The `argument` can be either a C string or a C++ string object:
`ContainsRegex()` and `MatchesRegex()` take ownership of the `RE` object. They
use the regular expression syntax defined
-[here](advanced.md#regular-expression-syntax). `StrCaseEq()`, `StrCaseNe()`,
-`StrEq()`, and `StrNe()` work for wide strings as well.
+[here](../../googletest/docs/advanced.md#regular-expression-syntax).
+`StrCaseEq()`, `StrCaseNe()`, `StrEq()`, and `StrNe()` work for wide strings as
+well.
#### Container Matchers
diff --git a/googlemock/docs/cook_book.md b/googlemock/docs/cook_book.md
index b28b84e8..28f7ba1d 100644
--- a/googlemock/docs/cook_book.md
+++ b/googlemock/docs/cook_book.md
@@ -178,7 +178,7 @@ class MockStack : public StackInterface<Elem> {
#### Mocking Non-virtual Methods {#MockingNonVirtualMethods}
gMock can mock non-virtual functions to be used in Hi-perf dependency
-injection.[See this](http://go/tott/33).
+injection.<!-- GOOGLETEST_CM0017 DO NOT DELETE -->
In this case, instead of sharing a common base class with the real class, your
mock class will be *unrelated* to the real class, but contain methods with the
diff --git a/googlemock/docs/for_dummies.md b/googlemock/docs/for_dummies.md
index ad00ada2..e11c18d9 100644
--- a/googlemock/docs/for_dummies.md
+++ b/googlemock/docs/for_dummies.md
@@ -396,7 +396,8 @@ EXPECT_CALL(turtle, GoTo);
This works for all non-overloaded methods; if a method is overloaded, you need
to help gMock resolve which overload is expected by specifying the number of
-arguments and possibly also the [types of the arguments](#SelectOverload).
+arguments and possibly also the
+[types of the arguments](cook_book.md#SelectOverload).
#### Cardinalities: How Many Times Will It Be Called?
@@ -482,7 +483,7 @@ the *default* action for the function every time (unless, of course, you have a
What can we do inside `WillOnce()` besides `Return()`? You can return a
reference using `ReturnRef(*variable*)`, or invoke a pre-defined function, among
-[others](#ActionList).
+[others](cook_book.md#using-actions).
**Important note:** The `EXPECT_CALL()` statement evaluates the action clause
only once, even though the action may be performed many times. Therefore you
@@ -560,7 +561,7 @@ overloaded). This makes any calls to the method expected. This is not necessary
for methods that are not mentioned at all (these are "uninteresting"), but is
useful for methods that have some expectations, but for which other calls are
ok. See
-[Understanding Uninteresting vs Unexpected Calls](#uninteresting-vs-unexpected).
+[Understanding Uninteresting vs Unexpected Calls](cook_book.md#uninteresting-vs-unexpected).
#### Ordered vs Unordered Calls {#OrderedCalls}
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index e921cf4a..9605c43a 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -532,7 +532,7 @@ class ReturnAction {
// in the Impl class. But both definitions must be the same.
typedef typename Function<F>::Result Result;
GTEST_COMPILE_ASSERT_(
- !is_reference<Result>::value,
+ !std::is_reference<Result>::value,
use_ReturnRef_instead_of_Return_to_return_a_reference);
static_assert(!std::is_void<Result>::value,
"Can't use Return() on an action expected to return `void`.");
@@ -561,7 +561,7 @@ class ReturnAction {
Result Perform(const ArgumentTuple&) override { return value_; }
private:
- GTEST_COMPILE_ASSERT_(!is_reference<Result>::value,
+ GTEST_COMPILE_ASSERT_(!std::is_reference<Result>::value,
Result_cannot_be_a_reference_type);
// We save the value before casting just in case it is being cast to a
// wrapper type.
@@ -640,7 +640,7 @@ class ReturnRefAction {
// Asserts that the function return type is a reference. This
// catches the user error of using ReturnRef(x) when Return(x)
// should be used, and generates some helpful error message.
- GTEST_COMPILE_ASSERT_(internal::is_reference<Result>::value,
+ GTEST_COMPILE_ASSERT_(std::is_reference<Result>::value,
use_Return_instead_of_ReturnRef_to_return_a_value);
return Action<F>(new Impl<F>(ref_));
}
@@ -687,7 +687,7 @@ class ReturnRefOfCopyAction {
// catches the user error of using ReturnRefOfCopy(x) when Return(x)
// should be used, and generates some helpful error message.
GTEST_COMPILE_ASSERT_(
- internal::is_reference<Result>::value,
+ std::is_reference<Result>::value,
use_Return_instead_of_ReturnRefOfCopy_to_return_a_value);
return Action<F>(new Impl<F>(value_));
}
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 70750827..b1c0dc04 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -132,19 +132,16 @@ class MatcherCastImpl {
// polymorphic_matcher_or_value to Matcher<T> because it won't trigger
// a user-defined conversion from M to T if one exists (assuming M is
// a value).
- return CastImpl(
- polymorphic_matcher_or_value,
- BooleanConstant<
- std::is_convertible<M, Matcher<T> >::value>(),
- BooleanConstant<
- std::is_convertible<M, T>::value>());
+ return CastImpl(polymorphic_matcher_or_value,
+ bool_constant<std::is_convertible<M, Matcher<T>>::value>(),
+ bool_constant<std::is_convertible<M, T>::value>());
}
private:
template <bool Ignore>
static Matcher<T> CastImpl(const M& polymorphic_matcher_or_value,
- BooleanConstant<true> /* convertible_to_matcher */,
- BooleanConstant<Ignore>) {
+ bool_constant<true> /* convertible_to_matcher */,
+ bool_constant<Ignore>) {
// M is implicitly convertible to Matcher<T>, which means that either
// M is a polymorphic matcher or Matcher<T> has an implicit constructor
// from M. In both cases using the implicit conversion will produce a
@@ -159,9 +156,9 @@ class MatcherCastImpl {
// M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic
// matcher. It's a value of a type implicitly convertible to T. Use direct
// initialization to create a matcher.
- static Matcher<T> CastImpl(
- const M& value, BooleanConstant<false> /* convertible_to_matcher */,
- BooleanConstant<true> /* convertible_to_T */) {
+ static Matcher<T> CastImpl(const M& value,
+ bool_constant<false> /* convertible_to_matcher */,
+ bool_constant<true> /* convertible_to_T */) {
return Matcher<T>(ImplicitCast_<T>(value));
}
@@ -175,9 +172,9 @@ class MatcherCastImpl {
// (e.g. std::pair<const int, int> vs. std::pair<int, int>).
//
// We don't define this method inline as we need the declaration of Eq().
- static Matcher<T> CastImpl(
- const M& value, BooleanConstant<false> /* convertible_to_matcher */,
- BooleanConstant<false> /* convertible_to_T */);
+ static Matcher<T> CastImpl(const M& value,
+ bool_constant<false> /* convertible_to_matcher */,
+ bool_constant<false> /* convertible_to_T */);
};
// This more specialized version is used when MatcherCast()'s argument
@@ -280,7 +277,7 @@ class SafeMatcherCastImpl {
// Enforce that we are not converting a non-reference type T to a reference
// type U.
GTEST_COMPILE_ASSERT_(
- internal::is_reference<T>::value || !internal::is_reference<U>::value,
+ std::is_reference<T>::value || !std::is_reference<U>::value,
cannot_convert_non_reference_arg_to_reference);
// In case both T and U are arithmetic types, enforce that the
// conversion is not lossy.
@@ -1610,8 +1607,9 @@ class PointeeMatcher {
template <typename Pointer>
class Impl : public MatcherInterface<Pointer> {
public:
- typedef typename PointeeOf<GTEST_REMOVE_CONST_( // NOLINT
- GTEST_REMOVE_REFERENCE_(Pointer))>::type Pointee;
+ typedef
+ typename PointeeOf<typename std::remove_const<GTEST_REMOVE_REFERENCE_(
+ Pointer)>::type>::type Pointee;
explicit Impl(const InnerMatcher& matcher)
: matcher_(MatcherCast<const Pointee&>(matcher)) {}
@@ -1749,8 +1747,8 @@ class FieldMatcher {
// FIXME: The dispatch on std::is_pointer was introduced as a workaround for
// a compiler bug, and can now be removed.
return MatchAndExplainImpl(
- typename std::is_pointer<GTEST_REMOVE_CONST_(T)>::type(), value,
- listener);
+ typename std::is_pointer<typename std::remove_const<T>::type>::type(),
+ value, listener);
}
private:
@@ -1816,8 +1814,8 @@ class PropertyMatcher {
template <typename T>
bool MatchAndExplain(const T&value, MatchResultListener* listener) const {
return MatchAndExplainImpl(
- typename std::is_pointer<GTEST_REMOVE_CONST_(T)>::type(), value,
- listener);
+ typename std::is_pointer<typename std::remove_const<T>::type>::type(),
+ value, listener);
}
private:
@@ -2093,9 +2091,8 @@ class ContainerEqMatcher {
template <typename LhsContainer>
bool MatchAndExplain(const LhsContainer& lhs,
MatchResultListener* listener) const {
- // GTEST_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug
- // that causes LhsContainer to be a const type sometimes.
- typedef internal::StlContainerView<GTEST_REMOVE_CONST_(LhsContainer)>
+ typedef internal::StlContainerView<
+ typename std::remove_const<LhsContainer>::type>
LhsView;
typedef typename LhsView::type LhsStlContainer;
StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
@@ -3603,9 +3600,8 @@ inline Matcher<T> An() { return A<T>(); }
template <typename T, typename M>
Matcher<T> internal::MatcherCastImpl<T, M>::CastImpl(
- const M& value,
- internal::BooleanConstant<false> /* convertible_to_matcher */,
- internal::BooleanConstant<false> /* convertible_to_T */) {
+ const M& value, internal::bool_constant<false> /* convertible_to_matcher */,
+ internal::bool_constant<false> /* convertible_to_T */) {
return Eq(value);
}
@@ -4034,12 +4030,12 @@ BeginEndDistanceIs(const DistanceMatcher& distance_matcher) {
// values that are included in one container but not the other. (Duplicate
// values and order differences are not explained.)
template <typename Container>
-inline PolymorphicMatcher<internal::ContainerEqMatcher< // NOLINT
- GTEST_REMOVE_CONST_(Container)> >
- ContainerEq(const Container& rhs) {
+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 GTEST_REMOVE_CONST_(Container) RawContainer;
+ typedef typename std::remove_const<Container>::type RawContainer;
return MakePolymorphicMatcher(
internal::ContainerEqMatcher<RawContainer>(rhs));
}
@@ -4072,12 +4068,12 @@ WhenSorted(const ContainerMatcher& container_matcher) {
// LHS container and the RHS container respectively.
template <typename TupleMatcher, typename Container>
inline internal::PointwiseMatcher<TupleMatcher,
- GTEST_REMOVE_CONST_(Container)>
+ 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 GTEST_REMOVE_CONST_(Container) RawContainer;
+ typedef typename std::remove_const<Container>::type RawContainer;
return internal::PointwiseMatcher<TupleMatcher, RawContainer>(
tuple_matcher, rhs);
}
@@ -4105,14 +4101,15 @@ inline internal::PointwiseMatcher<TupleMatcher, std::vector<T> > Pointwise(
template <typename Tuple2Matcher, typename RhsContainer>
inline internal::UnorderedElementsAreArrayMatcher<
typename internal::BoundSecondMatcher<
- Tuple2Matcher, typename internal::StlContainerView<GTEST_REMOVE_CONST_(
- RhsContainer)>::type::value_type> >
+ Tuple2Matcher,
+ typename internal::StlContainerView<
+ 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 GTEST_REMOVE_CONST_(RhsContainer) RawRhsContainer;
+ 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.
diff --git a/googlemock/include/gmock/gmock-more-actions.h b/googlemock/include/gmock/gmock-more-actions.h
index a052495d..d42484ae 100644
--- a/googlemock/include/gmock/gmock-more-actions.h
+++ b/googlemock/include/gmock/gmock-more-actions.h
@@ -105,7 +105,7 @@ ACTION_TEMPLATE(SetArgReferee,
// Ensures that argument #k is a reference. If you get a compiler
// error on the next line, you are using SetArgReferee<k>(value) in
// a mock function whose k-th (0-based) argument is not a reference.
- GTEST_COMPILE_ASSERT_(internal::is_reference<argk_type>::value,
+ GTEST_COMPILE_ASSERT_(std::is_reference<argk_type>::value,
SetArgReferee_must_be_used_with_a_reference_argument);
::std::get<k>(args) = value;
}
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index 735a3bcb..0d1adda5 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -67,6 +67,7 @@
#include <set>
#include <sstream>
#include <string>
+#include <type_traits>
#include <utility>
#include <vector>
#include "gmock/gmock-actions.h"
@@ -1653,9 +1654,8 @@ class FunctionMocker<R(Args...)> final : public UntypedFunctionMockerBase {
const OnCallSpec<F>* const spec = FindOnCallSpec(args);
if (spec == nullptr) {
- *os << (internal::type_equals<Result, void>::value ?
- "returning directly.\n" :
- "returning default value.\n");
+ *os << (std::is_void<Result>::value ? "returning directly.\n"
+ : "returning default value.\n");
} else {
*os << "taking default action specified at:\n"
<< FormatFileLocation(spec->file(), spec->line()) << "\n";
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h
index 8424908e..1770d5e7 100644
--- a/googlemock/include/gmock/internal/gmock-internal-utils.h
+++ b/googlemock/include/gmock/internal/gmock-internal-utils.h
@@ -106,25 +106,6 @@ inline Element* GetRawPointer(Element* p) { return p; }
# define GMOCK_WCHAR_T_IS_NATIVE_ 1
#endif
-// signed wchar_t and unsigned wchar_t are NOT in the C++ standard.
-// Using them is a bad practice and not portable. So DON'T use them.
-//
-// Still, Google Mock is designed to work even if the user uses signed
-// wchar_t or unsigned wchar_t (obviously, assuming the compiler
-// supports them).
-//
-// To gcc,
-// wchar_t == signed wchar_t != unsigned wchar_t == unsigned int
-//
-// gcc-9 appears to treat signed/unsigned wchar_t as ill-formed
-// regardless of the signage of its underlying type.
-#ifdef __GNUC__
-#if !defined(__WCHAR_UNSIGNED__) && (__GNUC__ < 9)
-// signed/unsigned wchar_t are valid types.
-# define GMOCK_HAS_SIGNED_WCHAR_T_ 1
-#endif
-#endif
-
// In what follows, we use the term "kind" to indicate whether a type
// is bool, an integer type (excluding bool), a floating-point type,
// or none of them. This categorization is useful for determining
@@ -189,27 +170,27 @@ GMOCK_DECLARE_KIND_(long double, kFloatingPoint);
// From, and kToKind is the kind of To; the value is
// implementation-defined when the above pre-condition is violated.
template <TypeKind kFromKind, typename From, TypeKind kToKind, typename To>
-struct LosslessArithmeticConvertibleImpl : public false_type {};
+struct LosslessArithmeticConvertibleImpl : public std::false_type {};
// Converting bool to bool is lossless.
template <>
struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool>
- : public true_type {}; // NOLINT
+ : public std::true_type {};
// Converting bool to any integer type is lossless.
template <typename To>
struct LosslessArithmeticConvertibleImpl<kBool, bool, kInteger, To>
- : public true_type {}; // NOLINT
+ : public std::true_type {};
// Converting bool to any floating-point type is lossless.
template <typename To>
struct LosslessArithmeticConvertibleImpl<kBool, bool, kFloatingPoint, To>
- : public true_type {}; // NOLINT
+ : public std::true_type {};
// Converting an integer to bool is lossy.
template <typename From>
struct LosslessArithmeticConvertibleImpl<kInteger, From, kBool, bool>
- : public false_type {}; // NOLINT
+ : public std::false_type {};
// Converting an integer to another non-bool integer is lossless if
// the target type's range encloses the source type's range.
@@ -230,17 +211,17 @@ struct LosslessArithmeticConvertibleImpl<kInteger, From, kInteger, To>
// the format of a floating-point number is implementation-defined.
template <typename From, typename To>
struct LosslessArithmeticConvertibleImpl<kInteger, From, kFloatingPoint, To>
- : public false_type {}; // NOLINT
+ : public std::false_type {};
// Converting a floating-point to bool is lossy.
template <typename From>
struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool>
- : public false_type {}; // NOLINT
+ : public std::false_type {};
// Converting a floating-point to an integer is lossy.
template <typename From, typename To>
struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kInteger, To>
- : public false_type {}; // NOLINT
+ : public std::false_type {};
// Converting a floating-point to another floating-point is lossless
// if the target type is at least as big as the source type.
@@ -355,14 +336,6 @@ GTEST_API_ WithoutMatchers GetWithoutMatchers();
// Type traits.
-// is_reference<T>::value is non-zero if T is a reference type.
-template <typename T> struct is_reference : public false_type {};
-template <typename T> struct is_reference<T&> : public true_type {};
-
-// type_equals<T1, T2>::value is non-zero if T1 and T2 are the same type.
-template <typename T1, typename T2> struct type_equals : public false_type {};
-template <typename T> struct type_equals<T, T> : public true_type {};
-
// remove_reference<T>::type removes the reference from type T, if any.
template <typename T> struct remove_reference { typedef T type; }; // NOLINT
template <typename T> struct remove_reference<T&> { typedef T type; }; // NOLINT
@@ -416,8 +389,8 @@ class StlContainerView {
static const_reference ConstReference(const RawContainer& container) {
// Ensures that RawContainer is not a const type.
- testing::StaticAssertTypeEq<RawContainer,
- GTEST_REMOVE_CONST_(RawContainer)>();
+ testing::StaticAssertTypeEq<
+ RawContainer, typename std::remove_const<RawContainer>::type>();
return container;
}
static type Copy(const RawContainer& container) { return container; }
@@ -427,7 +400,7 @@ class StlContainerView {
template <typename Element, size_t N>
class StlContainerView<Element[N]> {
public:
- typedef GTEST_REMOVE_CONST_(Element) RawElement;
+ typedef typename std::remove_const<Element>::type RawElement;
typedef internal::NativeArray<RawElement> type;
// NativeArray<T> can represent a native array either by value or by
// reference (selected by a constructor argument), so 'const type'
@@ -451,8 +424,8 @@ class StlContainerView<Element[N]> {
template <typename ElementPointer, typename Size>
class StlContainerView< ::std::tuple<ElementPointer, Size> > {
public:
- typedef GTEST_REMOVE_CONST_(
- typename internal::PointeeOf<ElementPointer>::type) RawElement;
+ typedef typename std::remove_const<
+ typename internal::PointeeOf<ElementPointer>::type>::type RawElement;
typedef internal::NativeArray<RawElement> type;
typedef const type const_reference;
@@ -484,28 +457,12 @@ struct RemoveConstFromKey<std::pair<const K, V> > {
typedef std::pair<K, V> type;
};
-// Mapping from booleans to types. Similar to boost::bool_<kValue> and
-// std::integral_constant<bool, kValue>.
-template <bool kValue>
-struct BooleanConstant {};
-
// Emit an assertion failure due to incorrect DoDefault() usage. Out-of-lined to
// reduce code size.
GTEST_API_ void IllegalDoDefault(const char* file, int line);
-// Helper types for Apply() below.
-template <size_t... Is> struct int_pack { typedef int_pack type; };
-
-template <class Pack, size_t I> struct append;
-template <size_t... Is, size_t I>
-struct append<int_pack<Is...>, I> : int_pack<Is..., I> {};
-
-template <size_t C>
-struct make_int_pack : append<typename make_int_pack<C - 1>::type, C - 1> {};
-template <> struct make_int_pack<0> : int_pack<> {};
-
template <typename F, typename Tuple, size_t... Idx>
-auto ApplyImpl(F&& f, Tuple&& args, int_pack<Idx...>) -> decltype(
+auto ApplyImpl(F&& f, Tuple&& args, IndexSequence<Idx...>) -> decltype(
std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...)) {
return std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...);
}
@@ -514,9 +471,9 @@ auto ApplyImpl(F&& f, Tuple&& args, int_pack<Idx...>) -> decltype(
template <typename F, typename Tuple>
auto Apply(F&& f, Tuple&& args)
-> decltype(ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args),
- make_int_pack<std::tuple_size<Tuple>::value>())) {
+ MakeIndexSequence<std::tuple_size<Tuple>::value>())) {
return ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args),
- make_int_pack<std::tuple_size<Tuple>::value>());
+ MakeIndexSequence<std::tuple_size<Tuple>::value>());
}
// Template struct Function<F>, where F must be a function type, contains
diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel
index e74102fb..da95ed58 100644
--- a/googlemock/test/BUILD.bazel
+++ b/googlemock/test/BUILD.bazel
@@ -32,6 +32,9 @@
#
# Bazel Build for Google C++ Testing Framework(Google Test)-googlemock
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
+load("@rules_python//python:defs.bzl", "py_library", "py_test")
+
licenses(["notice"])
# Tests for GMock itself
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc
index f761b446..f63c8c5a 100644
--- a/googlemock/test/gmock-actions_test.cc
+++ b/googlemock/test/gmock-actions_test.cc
@@ -105,10 +105,6 @@ TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) {
EXPECT_EQ(0U, BuiltInDefaultValue<unsigned char>::Get());
EXPECT_EQ(0, BuiltInDefaultValue<signed char>::Get());
EXPECT_EQ(0, BuiltInDefaultValue<char>::Get());
-#if GMOCK_HAS_SIGNED_WCHAR_T_
- EXPECT_EQ(0U, BuiltInDefaultValue<unsigned wchar_t>::Get());
- EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
-#endif
#if GMOCK_WCHAR_T_IS_NATIVE_
#if !defined(__WCHAR_UNSIGNED__)
EXPECT_EQ(0, BuiltInDefaultValue<wchar_t>::Get());
@@ -137,10 +133,6 @@ TEST(BuiltInDefaultValueTest, ExistsForNumericTypes) {
EXPECT_TRUE(BuiltInDefaultValue<unsigned char>::Exists());
EXPECT_TRUE(BuiltInDefaultValue<signed char>::Exists());
EXPECT_TRUE(BuiltInDefaultValue<char>::Exists());
-#if GMOCK_HAS_SIGNED_WCHAR_T_
- EXPECT_TRUE(BuiltInDefaultValue<unsigned wchar_t>::Exists());
- EXPECT_TRUE(BuiltInDefaultValue<signed wchar_t>::Exists());
-#endif
#if GMOCK_WCHAR_T_IS_NATIVE_
EXPECT_TRUE(BuiltInDefaultValue<wchar_t>::Exists());
#endif
diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc
index a76e777c..67b7077f 100644
--- a/googlemock/test/gmock-internal-utils_test.cc
+++ b/googlemock/test/gmock-internal-utils_test.cc
@@ -33,16 +33,20 @@
// This file tests the internal utilities.
#include "gmock/internal/gmock-internal-utils.h"
+
#include <stdlib.h>
+
#include <map>
#include <memory>
-#include <string>
#include <sstream>
+#include <string>
+#include <type_traits>
#include <vector>
+
#include "gmock/gmock.h"
#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
#include "gtest/gtest-spi.h"
+#include "gtest/gtest.h"
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
@@ -504,33 +508,12 @@ TEST(LogTest, OnlyWarningsArePrintedWhenVerbosityIsInvalid) {
#endif // GTEST_HAS_STREAM_REDIRECTION
-TEST(TypeTraitsTest, true_type) {
- EXPECT_TRUE(true_type::value);
-}
-
-TEST(TypeTraitsTest, false_type) {
- EXPECT_FALSE(false_type::value);
-}
-
-TEST(TypeTraitsTest, is_reference) {
- EXPECT_FALSE(is_reference<int>::value);
- EXPECT_FALSE(is_reference<char*>::value);
- EXPECT_TRUE(is_reference<const int&>::value);
-}
-
-TEST(TypeTraitsTest, type_equals) {
- EXPECT_FALSE((type_equals<int, const int>::value));
- EXPECT_FALSE((type_equals<int, int&>::value));
- EXPECT_FALSE((type_equals<int, double>::value));
- EXPECT_TRUE((type_equals<char, char>::value));
-}
-
TEST(TypeTraitsTest, remove_reference) {
- EXPECT_TRUE((type_equals<char, remove_reference<char&>::type>::value));
- EXPECT_TRUE((type_equals<const int,
- remove_reference<const int&>::type>::value));
- EXPECT_TRUE((type_equals<int, remove_reference<int>::type>::value));
- EXPECT_TRUE((type_equals<double*, remove_reference<double*>::type>::value));
+ EXPECT_TRUE((std::is_same<char, remove_reference<char&>::type>::value));
+ EXPECT_TRUE(
+ (std::is_same<const int, remove_reference<const int&>::type>::value));
+ EXPECT_TRUE((std::is_same<int, remove_reference<int>::type>::value));
+ EXPECT_TRUE((std::is_same<double*, remove_reference<double*>::type>::value));
}
#if GTEST_HAS_STREAM_REDIRECTION
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc
index 74e9294f..a61d040b 100644
--- a/googlemock/test/gmock-matchers_test.cc
+++ b/googlemock/test/gmock-matchers_test.cc
@@ -6434,7 +6434,7 @@ class SampleVariantIntString {
template <typename T>
friend bool holds_alternative(const SampleVariantIntString& value) {
- return value.has_int_ == internal::IsSame<T, int>::value;
+ return value.has_int_ == std::is_same<T, int>::value;
}
template <typename T>