From e033d8c73de8d757fa30d22626ae026f43be6bd5 Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Thu, 31 Aug 2017 18:12:17 +0200 Subject: change links from former code.google.com to current github repository --- googlemock/include/gmock/gmock-generated-matchers.h.pump | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index de30c2c9..f91b1eab 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -587,7 +587,7 @@ $$ // show up in the generated code. // ================ // // To learn more about using these macros, please search for 'MATCHER' -// on http://code.google.com/p/googlemock/wiki/CookBook. +// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md $range i 0..n $for i -- cgit v1.2.3 From 20e2de7d8bba9f3735c9a67b000f04853927a0f8 Mon Sep 17 00:00:00 2001 From: Romain Geissler Date: Fri, 21 Oct 2016 17:42:48 +0200 Subject: Remove gcc 6 misleading indentations. --- googlemock/include/gmock/gmock-generated-matchers.h.pump | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index f91b1eab..25d2da99 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -639,8 +639,9 @@ $var param_field_decls2 = [[$for j private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ -- cgit v1.2.3 From e1071eb9497304a38e69737e90a88b4877b8b736 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 10 Apr 2018 15:57:16 -0400 Subject: RE-Doing the merge, this time with gcc on mac in the PR so I can catch errors before merging the PR --- googlemock/include/gmock/gmock-generated-matchers.h.pump | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index 25d2da99..4fe0a61c 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -1,6 +1,6 @@ $$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert it to -$$ gmock-generated-actions.h. +$$ This is a Pump source file. Please use Pump to convert +$$ it to gmock-generated-matchers.h. $$ $var n = 10 $$ The maximum arity we support. $$ }} This line fixes auto-indentation of the following code in Emacs. -- cgit v1.2.3 From bd2a1aed03c8319f43ee01ed675d2a2365aac7c5 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 16 Apr 2018 11:18:49 -0400 Subject: merging gmock generated matchers --- .../include/gmock/gmock-generated-matchers.h.pump | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index 4fe0a61c..4b628444 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -303,6 +303,9 @@ $for j, [[ // UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension // that matches n elements in any order. We support up to n=$n arguments. +// +// If you have >$n elements, consider UnorderedElementsAreArray() or +// UnorderedPointwise() instead. $range i 0..n $for i [[ @@ -479,7 +482,7 @@ $$ // show up in the generated code. // using testing::PrintToString; // // MATCHER_P2(InClosedRange, low, hi, -// string(negation ? "is not" : "is") + " in range [" + +// std::string(negation ? "is not" : "is") + " in range [" + // PrintToString(low) + ", " + PrintToString(hi) + "]") { // return low <= arg && arg <= hi; // } @@ -604,32 +607,34 @@ $var template = [[$if i==0 [[]] $else [[ ]]]] $var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] -$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] -$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] +$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::move(gmock_p$j))]]]]]] +$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::move(gmock_p$j))]]]]]] $var params = [[$for j, [[p$j]]]] $var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] $var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] $var param_field_decls = [[$for j [[ - p$j##_type p$j;\ + p$j##_type const p$j;\ ]]]] $var param_field_decls2 = [[$for j [[ - p$j##_type p$j;\ + p$j##_type const p$j;\ ]]]] #define $macro_name(name$for j [[, p$j]], description)\$template class $class_name {\ public:\ template \ - class gmock_Impl : public ::testing::MatcherInterface {\ + class gmock_Impl : public ::testing::MatcherInterface<\ + GTEST_REFERENCE_TO_CONST_(arg_type)> {\ public:\ [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ $impl_inits {}\ virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ + ::testing::MatchResultListener* result_listener) const;\ virtual void DescribeTo(::std::ostream* gmock_os) const {\ *gmock_os << FormatDescription(false);\ }\ @@ -637,17 +642,15 @@ $var param_field_decls2 = [[$for j *gmock_os << FormatDescription(true);\ }\$param_field_decls private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ + ::std::string FormatDescription(bool negation) const {\ + ::std::string gmock_description = (description);\ + if (!gmock_description.empty())\ return gmock_description;\ - }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ };\ template \ operator ::testing::Matcher() const {\ @@ -657,14 +660,13 @@ $var param_field_decls2 = [[$for j [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\ }\$param_field_decls2 private:\ - GTEST_DISALLOW_ASSIGN_($class_name);\ };\$template inline $class_name$param_types name($param_types_and_names) {\ return $class_name$param_types($params);\ }\$template template \ bool $class_name$param_types::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ const ]] -- cgit v1.2.3 From 984cba30ed10622122c12960b4914656fc770e04 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 27 Jul 2018 11:15:08 -0400 Subject: Formatting changes for automatic code management --- googlemock/include/gmock/gmock-generated-matchers.h.pump | 2 ++ 1 file changed, 2 insertions(+) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index 4b628444..9fe0fd7a 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -37,6 +37,8 @@ $$ }} This line fixes auto-indentation of the following code in Emacs. // // This file implements some commonly used variadic matchers. +// GOOGLETEST_CM0002 DO NOT DELETE + #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ -- cgit v1.2.3 From 65d03530e6a1f243f89941a5c7400a0ce89d8de7 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 28 Aug 2018 10:28:15 -0400 Subject: Googletest export Fix line that was wrapping in the middle of a link This looks uglier, but has the advantage that the link is kept in one piece. PiperOrigin-RevId: 210537337 --- googlemock/include/gmock/gmock-generated-matchers.h.pump | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index 9fe0fd7a..1a59fede 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -592,7 +592,8 @@ $$ // show up in the generated code. // ================ // // To learn more about using these macros, please search for 'MATCHER' -// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md +// on +// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md $range i 0..n $for i -- cgit v1.2.3 From 93b05da26ca9e8862d137078fe087b274f34429a Mon Sep 17 00:00:00 2001 From: Romain Geissler Date: Mon, 10 Sep 2018 01:45:14 +0200 Subject: Fix gcc misleading indentation again. --- googlemock/include/gmock/gmock-generated-matchers.h.pump | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index 1a59fede..9b3a6e4d 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -647,8 +647,9 @@ $var param_field_decls2 = [[$for j private:\ ::std::string FormatDescription(bool negation) const {\ ::std::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ -- cgit v1.2.3 From ba974c97ac6cb9eecd55cb2ed736fea32939cb51 Mon Sep 17 00:00:00 2001 From: misterg Date: Mon, 24 Sep 2018 10:57:59 -0400 Subject: Googletest export Remove non-variadic pre C++11 ElementsAreMatcher and UnorderedElementsAreMatcher PiperOrigin-RevId: 214266944 --- .../include/gmock/gmock-generated-matchers.h.pump | 69 ---------------------- 1 file changed, 69 deletions(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index 9b3a6e4d..e1f2f838 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -263,75 +263,6 @@ Args(const InnerMatcher& matcher) { } -]] -// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with -// n elements, where the i-th element in the container must -// match the i-th argument in the list. Each argument of -// ElementsAre() can be either a value or a matcher. We support up to -// $n arguments. -// -// The use of DecayArray in the implementation allows ElementsAre() -// to accept string literals, whose type is const char[N], but we -// want to treat them as const char*. -// -// NOTE: Since ElementsAre() cares about the order of the elements, it -// must not be used with containers whose elements's order is -// undefined (e.g. hash_map). - -$range i 0..n -$for i [[ - -$range j 1..i - -$if i>0 [[ - -template <$for j, [[typename T$j]]> -]] - -inline internal::ElementsAreMatcher< - ::testing::tuple< -$for j, [[ - - typename internal::DecayArray::type]]> > -ElementsAre($for j, [[const T$j& e$j]]) { - typedef ::testing::tuple< -$for j, [[ - - typename internal::DecayArray::type]]> Args; - return internal::ElementsAreMatcher(Args($for j, [[e$j]])); -} - -]] - -// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension -// that matches n elements in any order. We support up to n=$n arguments. -// -// If you have >$n elements, consider UnorderedElementsAreArray() or -// UnorderedPointwise() instead. - -$range i 0..n -$for i [[ - -$range j 1..i - -$if i>0 [[ - -template <$for j, [[typename T$j]]> -]] - -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< -$for j, [[ - - typename internal::DecayArray::type]]> > -UnorderedElementsAre($for j, [[const T$j& e$j]]) { - typedef ::testing::tuple< -$for j, [[ - - typename internal::DecayArray::type]]> Args; - return internal::UnorderedElementsAreMatcher(Args($for j, [[e$j]])); -} - ]] // AllOf(m1, m2, ..., mk) matches any value that matches all of the given -- cgit v1.2.3 From fab35920ad7e709847a94175337b8674bea0f9ae Mon Sep 17 00:00:00 2001 From: misterg Date: Mon, 8 Oct 2018 10:30:02 -0400 Subject: Remove non-variadic pre C++11 AllOf PiperOrigin-RevId: 216183352 --- .../include/gmock/gmock-generated-matchers.h.pump | 50 ---------------------- 1 file changed, 50 deletions(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index e1f2f838..ad02ea7f 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -187,36 +187,6 @@ class ArgsMatcher { GTEST_DISALLOW_ASSIGN_(ArgsMatcher); }; -// A set of metafunctions for computing the result type of AllOf. -// AllOf(m1, ..., mN) returns -// AllOfResultN::type. - -// Although AllOf isn't defined for one argument, AllOfResult1 is defined -// to simplify the implementation. -template -struct AllOfResult1 { - typedef M1 type; -}; - -$range i 1..n - -$range i 2..n -$for i [[ -$range j 2..i -$var m = i/2 -$range k 1..m -$range t m+1..i - -template -struct AllOfResult$i { - typedef BothOfMatcher< - typename AllOfResult$m<$for k, [[M$k]]>::type, - typename AllOfResult$(i-m)<$for t, [[M$t]]>::type - > type; -}; - -]] - // A set of metafunctions for computing the result type of AnyOf. // AnyOf(m1, ..., mN) returns // AnyOfResultN::type. @@ -263,26 +233,6 @@ Args(const InnerMatcher& matcher) { } -]] - -// AllOf(m1, m2, ..., mk) matches any value that matches all of the given -// sub-matchers. AllOf is called fully qualified to prevent ADL from firing. - -$range i 2..n -$for i [[ -$range j 1..i -$var m = i/2 -$range k 1..m -$range t m+1..i - -template <$for j, [[typename M$j]]> -inline typename internal::AllOfResult$i<$for j, [[M$j]]>::type -AllOf($for j, [[M$j m$j]]) { - return typename internal::AllOfResult$i<$for j, [[M$j]]>::type( - $if m == 1 [[m1]] $else [[::testing::AllOf($for k, [[m$k]])]], - $if m+1 == i [[m$i]] $else [[::testing::AllOf($for t, [[m$t]])]]); -} - ]] // AnyOf(m1, m2, ..., mk) matches any value that matches any of the given -- cgit v1.2.3 From 7d3b73c85a42811309eac26e5cbe054c40b64785 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 9 Oct 2018 14:50:26 -0400 Subject: Unconditionally use std::tuple. Remove all mention of TR1 tuple and our own implementation of tuple. PiperOrigin-RevId: 216395043 --- .../include/gmock/gmock-generated-matchers.h.pump | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index ad02ea7f..311e1273 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -55,7 +55,7 @@ $range i 0..n-1 // The type of the i-th (0-based) field of Tuple. #define GMOCK_FIELD_TYPE_(Tuple, i) \ - typename ::testing::tuple_element::type + typename ::std::tuple_element::type // TupleFields is for selecting fields from a // tuple of type Tuple. It has two members: @@ -63,10 +63,11 @@ $range i 0..n-1 // type: a tuple type whose i-th field is the ki-th field of Tuple. // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. // -// For example, in class TupleFields, 2, 0>, we have: +// For example, in class TupleFields, 2, 0>, +// we have: // -// type is tuple, and -// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). +// type is std::tuple, and +// GetSelectedFields(std::make_tuple(true, 'a', 42)) is (42, true). template class TupleFields; @@ -75,9 +76,9 @@ class TupleFields; template class TupleFields { public: - typedef ::testing::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type; + typedef ::std::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type; static type GetSelectedFields(const Tuple& t) { - return type($for i, [[get(t)]]); + return type($for i, [[std::get(t)]]); } }; @@ -91,9 +92,9 @@ $range k 0..n-1 template class TupleFields { public: - typedef ::testing::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type; + typedef ::std::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type; static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) { - return type($for j, [[get(t)]]); + return type($for j, [[std::get(t)]]); } }; @@ -534,7 +535,7 @@ $var param_field_decls2 = [[$for j return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ + ::std::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ }\ };\ template \ -- cgit v1.2.3 From 78761b58fc9ae65acaebb6a9e34087e593c89c93 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 9 Oct 2018 16:26:28 -0400 Subject: Remove non-variadic pre C++11 AnyOf PiperOrigin-RevId: 216411381 --- .../include/gmock/gmock-generated-matchers.h.pump | 50 ---------------------- 1 file changed, 50 deletions(-) (limited to 'googlemock/include/gmock/gmock-generated-matchers.h.pump') diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index 311e1273..29b004d2 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -188,36 +188,6 @@ class ArgsMatcher { GTEST_DISALLOW_ASSIGN_(ArgsMatcher); }; -// A set of metafunctions for computing the result type of AnyOf. -// AnyOf(m1, ..., mN) returns -// AnyOfResultN::type. - -// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined -// to simplify the implementation. -template -struct AnyOfResult1 { - typedef M1 type; -}; - -$range i 1..n - -$range i 2..n -$for i [[ -$range j 2..i -$var m = i/2 -$range k 1..m -$range t m+1..i - -template -struct AnyOfResult$i { - typedef EitherOfMatcher< - typename AnyOfResult$m<$for k, [[M$k]]>::type, - typename AnyOfResult$(i-m)<$for t, [[M$t]]>::type - > type; -}; - -]] - } // namespace internal // Args(a_matcher) matches a tuple if the selected @@ -234,26 +204,6 @@ Args(const InnerMatcher& matcher) { } -]] - -// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given -// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. - -$range i 2..n -$for i [[ -$range j 1..i -$var m = i/2 -$range k 1..m -$range t m+1..i - -template <$for j, [[typename M$j]]> -inline typename internal::AnyOfResult$i<$for j, [[M$j]]>::type -AnyOf($for j, [[M$j m$j]]) { - return typename internal::AnyOfResult$i<$for j, [[M$j]]>::type( - $if m == 1 [[m1]] $else [[::testing::AnyOf($for k, [[m$k]])]], - $if m+1 == i [[m$i]] $else [[::testing::AnyOf($for t, [[m$t]])]]); -} - ]] } // namespace testing -- cgit v1.2.3