From 531bf5c41071d3251cb152fb5e4f2400c6ed9115 Mon Sep 17 00:00:00 2001 From: mazong1123 Date: Thu, 14 Jul 2016 13:44:46 +0800 Subject: [PATCH 1/2] Fixed issue #775 --- googlemock/test/gmock-matchers_test.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 78c4c901..29c9dc2c 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -613,7 +613,7 @@ TEST(MatcherCastTest, FromSameType) { struct ConvertibleFromAny { ConvertibleFromAny(int a_value) : value(a_value) {} template - ConvertibleFromAny(const T& /*a_value*/) : value(-1) { + explicit ConvertibleFromAny(const T& /*a_value*/) : value(-1) { ADD_FAILURE() << "Conversion constructor called"; } int value; @@ -867,11 +867,12 @@ class Unprintable { public: Unprintable() : c_('a') {} - bool operator==(const Unprintable& /* rhs */) { return true; } private: char c_; }; +inline bool operator==(const Unprintable&, /* lhs */ const Unprintable& /* rhs */) { return true; } + TEST(EqTest, CanDescribeSelf) { Matcher m = Eq(Unprintable()); EXPECT_EQ("is equal to 1-byte object <61>", Describe(m)); From dc2dbf1fbf1d10c02c3c3912e4b688333e310aa2 Mon Sep 17 00:00:00 2001 From: mazong1123 Date: Thu, 14 Jul 2016 16:49:42 +0800 Subject: [PATCH 2/2] Reformatted the Unprintable operator== code style. --- googlemock/test/gmock-matchers_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 29c9dc2c..9f62c3d8 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -871,7 +871,10 @@ class Unprintable { char c_; }; -inline bool operator==(const Unprintable&, /* lhs */ const Unprintable& /* rhs */) { return true; } +inline bool operator==(const Unprintable& /* lhs */, + const Unprintable& /* rhs */) { + return true; +} TEST(EqTest, CanDescribeSelf) { Matcher m = Eq(Unprintable());