aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2017-11-07 10:32:23 -0800
committerGitHub <noreply@github.com>2017-11-07 10:32:23 -0800
commit49eb76df471857fe1bd573b0636b1f9dd4fc8e4f (patch)
tree156d379675f771d096d84a2ced2972b46ed83a4a /googlemock
parentceee80c383d6f34af1a4e0fbb464f3f144cded68 (diff)
parentd175c8bf823e709d570772b038757fadf63bc632 (diff)
downloadgoogletest-49eb76df471857fe1bd573b0636b1f9dd4fc8e4f.tar.gz
googletest-49eb76df471857fe1bd573b0636b1f9dd4fc8e4f.tar.bz2
googletest-49eb76df471857fe1bd573b0636b1f9dd4fc8e4f.zip
Merge branch 'master' into hethi/issue-360-remove-GTEST_HAS_PARAM_TESTS
Diffstat (limited to 'googlemock')
-rw-r--r--googlemock/docs/CheatSheet.md2
-rw-r--r--googlemock/include/gmock/gmock-generated-matchers.h36
-rw-r--r--googlemock/include/gmock/gmock-generated-matchers.h.pump3
-rw-r--r--googlemock/test/gmock-generated-matchers_test.cc8
-rw-r--r--googlemock/test/gmock-matchers_test.cc12
5 files changed, 41 insertions, 20 deletions
diff --git a/googlemock/docs/CheatSheet.md b/googlemock/docs/CheatSheet.md
index c94c2dac..c6367fdd 100644
--- a/googlemock/docs/CheatSheet.md
+++ b/googlemock/docs/CheatSheet.md
@@ -65,7 +65,7 @@ can specify it by appending `_WITH_CALLTYPE` to any of the macros
described in the previous two sections and supplying the calling
convention as the first argument to the macro. For example,
```
- MOCK_METHOD_1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n));
+ MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n));
MOCK_CONST_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, Bar, int(double x, double y));
```
where `STDMETHODCALLTYPE` is defined by `<objbase.h>` on Windows.
diff --git a/googlemock/include/gmock/gmock-generated-matchers.h b/googlemock/include/gmock/gmock-generated-matchers.h
index 525f8a71..1655bcd3 100644
--- a/googlemock/include/gmock/gmock-generated-matchers.h
+++ b/googlemock/include/gmock/gmock-generated-matchers.h
@@ -1376,7 +1376,8 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
// ================
//
// 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
#define MATCHER(name, description)\
class name##Matcher {\
@@ -1397,8 +1398,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -1446,8 +1448,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -1499,8 +1502,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -1557,8 +1561,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -1620,8 +1625,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -1691,8 +1697,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -1765,8 +1772,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -1843,8 +1851,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -1928,8 +1937,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -2019,8 +2029,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
@@ -2115,8 +2126,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
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(\
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(\
diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc
index 8234858d..6cba726d 100644
--- a/googlemock/test/gmock-generated-matchers_test.cc
+++ b/googlemock/test/gmock-generated-matchers_test.cc
@@ -120,7 +120,7 @@ TEST(ArgsTest, AcceptsOneTemplateArg) {
}
TEST(ArgsTest, AcceptsTwoTemplateArgs) {
- const tuple<short, int, long> t(4, 5, 6L); // NOLINT
+ const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<0, 1>(Lt())));
EXPECT_THAT(t, (Args<1, 2>(Lt())));
@@ -128,13 +128,13 @@ TEST(ArgsTest, AcceptsTwoTemplateArgs) {
}
TEST(ArgsTest, AcceptsRepeatedTemplateArgs) {
- const tuple<short, int, long> t(4, 5, 6L); // NOLINT
+ const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<0, 0>(Eq())));
EXPECT_THAT(t, Not(Args<1, 1>(Ne())));
}
TEST(ArgsTest, AcceptsDecreasingTemplateArgs) {
- const tuple<short, int, long> t(4, 5, 6L); // NOLINT
+ const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT
EXPECT_THAT(t, (Args<2, 0>(Gt())));
EXPECT_THAT(t, Not(Args<2, 1>(Lt())));
}
@@ -159,7 +159,7 @@ TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) {
}
TEST(ArgsTest, CanBeNested) {
- const tuple<short, int, long, int> t(4, 5, 6L, 6); // NOLINT
+ const tuple<short, int, long, int> t(static_cast<short>(4), 5, 6L, 6); // NOLINT
EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq()))));
EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt()))));
}
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc
index fc867487..4beaec4c 100644
--- a/googlemock/test/gmock-matchers_test.cc
+++ b/googlemock/test/gmock-matchers_test.cc
@@ -58,6 +58,11 @@
# include <forward_list> // NOLINT
#endif
+// Disable MSVC2015 warning for std::pair: "decorated name length exceeded, name was truncated".
+#if defined(_MSC_VER) && (_MSC_VER == 1900)
+# pragma warning(disable:4503)
+#endif
+
namespace testing {
namespace internal {
@@ -3931,8 +3936,11 @@ TEST(ResultOfTest, WorksForFunctionReferences) {
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
// function object.
-struct Functor : public ::std::unary_function<int, std::string> {
- result_type operator()(argument_type input) const {
+struct Functor {
+ typedef std::string result_type;
+ typedef int argument_type;
+
+ std::string operator()(int input) const {
return IntToStringFunction(input);
}
};