mirror of
https://github.com/google/googletest.git
synced 2026-07-30 16:26:24 +08:00
Automated Code Change
PiperOrigin-RevId: 935893961 Change-Id: I90f8e57a7337f66a2afd37a2f0bc0e418e1ef51e
This commit is contained in:
parent
0b1e895ba4
commit
1fc11dea10
@ -161,8 +161,7 @@ class GTEST_API_ [[nodiscard]] AssertionResult {
|
||||
template <typename T>
|
||||
explicit AssertionResult(
|
||||
const T& success,
|
||||
typename std::enable_if<
|
||||
!std::is_convertible<T, AssertionResult>::value>::type*
|
||||
std::enable_if_t<!std::is_convertible_v<T, AssertionResult>>*
|
||||
/*enabler*/
|
||||
= nullptr)
|
||||
: success_(success) {}
|
||||
|
||||
@ -277,8 +277,8 @@ class [[nodiscard]] MatcherBase : private MatcherDescriberInterface {
|
||||
Init(impl);
|
||||
}
|
||||
|
||||
template <typename M, typename = typename std::remove_reference<
|
||||
M>::type::is_gtest_matcher>
|
||||
template <typename M,
|
||||
typename = typename std::remove_reference_t<M>::is_gtest_matcher>
|
||||
MatcherBase(M&& m) : vtable_(nullptr), buffer_() { // NOLINT
|
||||
Init(std::forward<M>(m));
|
||||
}
|
||||
@ -363,11 +363,10 @@ class [[nodiscard]] MatcherBase : private MatcherDescriberInterface {
|
||||
// from the impl, but some users really want to get their impl back when
|
||||
// they call GetDescriber().
|
||||
// We use std::get on a tuple as a workaround of not having `if constexpr`.
|
||||
return std::get<(
|
||||
std::is_convertible<decltype(&P::Get(m)),
|
||||
const MatcherDescriberInterface*>::value
|
||||
? 1
|
||||
: 0)>(std::make_tuple(&m, &P::Get(m)));
|
||||
return std::get<(std::is_convertible_v<decltype(&P::Get(m)),
|
||||
const MatcherDescriberInterface*>
|
||||
? 1
|
||||
: 0)>(std::make_tuple(&m, &P::Get(m)));
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
@ -396,8 +395,8 @@ class [[nodiscard]] MatcherBase : private MatcherDescriberInterface {
|
||||
template <typename M>
|
||||
static constexpr bool IsInlined() {
|
||||
return sizeof(M) <= sizeof(Buffer) && alignof(M) <= alignof(Buffer) &&
|
||||
std::is_trivially_copy_constructible<M>::value &&
|
||||
std::is_trivially_destructible<M>::value;
|
||||
std::is_trivially_copy_constructible_v<M> &&
|
||||
std::is_trivially_destructible_v<M>;
|
||||
}
|
||||
|
||||
template <typename M, bool = MatcherBase::IsInlined<M>()>
|
||||
@ -444,7 +443,7 @@ class [[nodiscard]] MatcherBase : private MatcherDescriberInterface {
|
||||
|
||||
template <typename M>
|
||||
void Init(M&& m) {
|
||||
using MM = typename std::decay<M>::type;
|
||||
using MM = std::decay_t<M>;
|
||||
using Policy = ValuePolicy<MM>;
|
||||
vtable_ = GetVTable<Policy>();
|
||||
Policy::Init(*this, std::forward<M>(m));
|
||||
@ -473,14 +472,12 @@ class [[nodiscard]] Matcher : public internal::MatcherBase<T> {
|
||||
: internal::MatcherBase<T>(impl) {}
|
||||
|
||||
template <typename U>
|
||||
explicit Matcher(
|
||||
const MatcherInterface<U>* impl,
|
||||
typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
|
||||
nullptr)
|
||||
explicit Matcher(const MatcherInterface<U>* impl,
|
||||
std::enable_if_t<!std::is_same_v<U, const U&>>* = nullptr)
|
||||
: internal::MatcherBase<T>(impl) {}
|
||||
|
||||
template <typename M, typename = typename std::remove_reference<
|
||||
M>::type::is_gtest_matcher>
|
||||
template <typename M,
|
||||
typename = typename std::remove_reference_t<M>::is_gtest_matcher>
|
||||
Matcher(M&& m) : internal::MatcherBase<T>(std::forward<M>(m)) {} // NOLINT
|
||||
|
||||
// Implicit constructor here allows people to write
|
||||
@ -509,8 +506,8 @@ Matcher<const std::string&> : public internal::MatcherBase<const std::string&> {
|
||||
explicit Matcher(const MatcherInterface<const std::string&>* impl)
|
||||
: internal::MatcherBase<const std::string&>(impl) {}
|
||||
|
||||
template <typename M, typename = typename std::remove_reference<
|
||||
M>::type::is_gtest_matcher>
|
||||
template <typename M,
|
||||
typename = typename std::remove_reference_t<M>::is_gtest_matcher>
|
||||
Matcher(M&& m) // NOLINT
|
||||
: internal::MatcherBase<const std::string&>(std::forward<M>(m)) {}
|
||||
|
||||
@ -533,8 +530,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
|
||||
explicit Matcher(const MatcherInterface<std::string>* impl)
|
||||
: internal::MatcherBase<std::string>(impl) {}
|
||||
|
||||
template <typename M, typename = typename std::remove_reference<
|
||||
M>::type::is_gtest_matcher>
|
||||
template <typename M,
|
||||
typename = typename std::remove_reference_t<M>::is_gtest_matcher>
|
||||
Matcher(M&& m) // NOLINT
|
||||
: internal::MatcherBase<std::string>(std::forward<M>(m)) {}
|
||||
|
||||
@ -559,8 +556,8 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
|
||||
explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
|
||||
: internal::MatcherBase<const internal::StringView&>(impl) {}
|
||||
|
||||
template <typename M, typename = typename std::remove_reference<
|
||||
M>::type::is_gtest_matcher>
|
||||
template <typename M,
|
||||
typename = typename std::remove_reference_t<M>::is_gtest_matcher>
|
||||
Matcher(M&& m) // NOLINT
|
||||
: internal::MatcherBase<const internal::StringView&>(std::forward<M>(m)) {
|
||||
}
|
||||
@ -587,8 +584,8 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
|
||||
explicit Matcher(const MatcherInterface<internal::StringView>* impl)
|
||||
: internal::MatcherBase<internal::StringView>(impl) {}
|
||||
|
||||
template <typename M, typename = typename std::remove_reference<
|
||||
M>::type::is_gtest_matcher>
|
||||
template <typename M,
|
||||
typename = typename std::remove_reference_t<M>::is_gtest_matcher>
|
||||
Matcher(M&& m) // NOLINT
|
||||
: internal::MatcherBase<internal::StringView>(std::forward<M>(m)) {}
|
||||
|
||||
@ -815,8 +812,8 @@ class [[nodiscard]] ImplicitCastEqMatcher {
|
||||
StoredRhs stored_rhs_;
|
||||
};
|
||||
|
||||
template <typename T, typename = typename std::enable_if<
|
||||
std::is_constructible<std::string, T>::value>::type>
|
||||
template <typename T,
|
||||
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
|
||||
using StringLike = T;
|
||||
|
||||
// Implements polymorphic matchers MatchesRegex(regex) and
|
||||
|
||||
@ -863,8 +863,8 @@ void PrintTupleTo(const T& t, std::integral_constant<size_t, I>,
|
||||
GTEST_INTENTIONAL_CONST_COND_POP_()
|
||||
*os << ", ";
|
||||
}
|
||||
UniversalPrinter<typename std::tuple_element<I - 1, T>::type>::Print(
|
||||
std::get<I - 1>(t), os);
|
||||
UniversalPrinter<std::tuple_element_t<I - 1, T>>::Print(std::get<I - 1>(t),
|
||||
os);
|
||||
}
|
||||
|
||||
template <typename... Types>
|
||||
@ -1218,7 +1218,7 @@ template <typename Tuple>
|
||||
Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
|
||||
Strings result;
|
||||
TersePrintPrefixToStrings(
|
||||
value, std::integral_constant<size_t, std::tuple_size<Tuple>::value>(),
|
||||
value, std::integral_constant<size_t, std::tuple_size_v<Tuple>>(),
|
||||
&result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -2164,7 +2164,7 @@ class GTEST_API_ [[nodiscard]] ScopedTrace {
|
||||
// to cause a compiler error.
|
||||
template <typename T1, typename T2>
|
||||
constexpr bool StaticAssertTypeEq() noexcept {
|
||||
static_assert(std::is_same<T1, T2>::value, "T1 and T2 are not the same type");
|
||||
static_assert(std::is_same_v<T1, T2>, "T1 and T2 are not the same type");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2310,7 +2310,7 @@ template <int&... ExplicitParameterBarrier, typename Factory>
|
||||
TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
|
||||
const char* type_param, const char* value_param,
|
||||
const char* file, int line, Factory factory) {
|
||||
using TestT = typename std::remove_pointer<decltype(factory())>::type;
|
||||
using TestT = std::remove_pointer_t<decltype(factory())>;
|
||||
|
||||
class FactoryImpl : public internal::TestFactoryBase {
|
||||
public:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user