diff options
author | kosak <kosak@google.com> | 2014-11-17 00:28:55 (GMT) |
---|---|---|
committer | kosak <kosak@google.com> | 2014-11-17 00:28:55 (GMT) |
commit | 5b9cbbb16d774bfcb51572d52eda3f7319088e23 (patch) | |
tree | 37a3062d21b4c056774ea2afe983c7050f1492be | |
parent | 2336e9c171b5894bac98f828289f537e29691896 (diff) | |
download | googletest-5b9cbbb16d774bfcb51572d52eda3f7319088e23.zip googletest-5b9cbbb16d774bfcb51572d52eda3f7319088e23.tar.gz googletest-5b9cbbb16d774bfcb51572d52eda3f7319088e23.tar.bz2 |
Distinguish between C++11 language and library support for std::function, std::begin, std::end, and std::move in gtest and gmock.
Bring in gtest 694.
-rw-r--r-- | include/gmock/gmock-generated-function-mockers.h | 44 | ||||
-rw-r--r-- | include/gmock/gmock-generated-function-mockers.h.pump | 4 | ||||
-rw-r--r-- | include/gmock/gmock-matchers.h | 2 | ||||
-rw-r--r-- | test/gmock-actions_test.cc | 10 | ||||
-rw-r--r-- | test/gmock-generated-function-mockers_test.cc | 4 | ||||
-rw-r--r-- | test/gmock-matchers_test.cc | 6 |
6 files changed, 35 insertions, 35 deletions
diff --git a/include/gmock/gmock-generated-function-mockers.h b/include/gmock/gmock-generated-function-mockers.h index d14e1ad..ce7341d 100644 --- a/include/gmock/gmock-generated-function-mockers.h +++ b/include/gmock/gmock-generated-function-mockers.h @@ -875,13 +875,13 @@ class MockFunction<R()> { MOCK_METHOD0_T(Call, R()); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R()> AsStdFunction() { return [this]() { return this->Call(); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -894,13 +894,13 @@ class MockFunction<R(A0)> { MOCK_METHOD1_T(Call, R(A0)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0)> AsStdFunction() { return [this](A0 a0) { return this->Call(a0); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -913,13 +913,13 @@ class MockFunction<R(A0, A1)> { MOCK_METHOD2_T(Call, R(A0, A1)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1)> AsStdFunction() { return [this](A0 a0, A1 a1) { return this->Call(a0, a1); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -932,13 +932,13 @@ class MockFunction<R(A0, A1, A2)> { MOCK_METHOD3_T(Call, R(A0, A1, A2)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1, A2)> AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2) { return this->Call(a0, a1, a2); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -951,13 +951,13 @@ class MockFunction<R(A0, A1, A2, A3)> { MOCK_METHOD4_T(Call, R(A0, A1, A2, A3)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1, A2, A3)> AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3) { return this->Call(a0, a1, a2, a3); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -971,13 +971,13 @@ class MockFunction<R(A0, A1, A2, A3, A4)> { MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1, A2, A3, A4)> AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) { return this->Call(a0, a1, a2, a3, a4); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -991,13 +991,13 @@ class MockFunction<R(A0, A1, A2, A3, A4, A5)> { MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1, A2, A3, A4, A5)> AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { return this->Call(a0, a1, a2, a3, a4, a5); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -1011,13 +1011,13 @@ class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> { MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1, A2, A3, A4, A5, A6)> AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { return this->Call(a0, a1, a2, a3, a4, a5, a6); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -1031,13 +1031,13 @@ class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> { MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1, A2, A3, A4, A5, A6, A7)> AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { return this->Call(a0, a1, a2, a3, a4, a5, a6, a7); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -1051,14 +1051,14 @@ class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> { MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); @@ -1073,14 +1073,14 @@ class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> { MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> AsStdFunction() { return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); diff --git a/include/gmock/gmock-generated-function-mockers.h.pump b/include/gmock/gmock-generated-function-mockers.h.pump index 5e83962..5928445 100644 --- a/include/gmock/gmock-generated-function-mockers.h.pump +++ b/include/gmock/gmock-generated-function-mockers.h.pump @@ -268,13 +268,13 @@ class MockFunction<R($ArgTypes)> { MOCK_METHOD$i[[]]_T(Call, R($ArgTypes)); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ std::function<R($ArgTypes)> AsStdFunction() { return [this]($ArgDecls) { return this->Call($ArgNames); }; } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h index 5211ca6..703dfe9 100644 --- a/include/gmock/gmock-matchers.h +++ b/include/gmock/gmock-matchers.h @@ -2373,7 +2373,7 @@ class BeginEndDistanceIsMatcher { virtual bool MatchAndExplain(Container container, MatchResultListener* listener) const { -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_BEGIN_AND_END_ using std::begin; using std::end; DistanceType distance = std::distance(begin(container), end(container)); diff --git a/test/gmock-actions_test.cc b/test/gmock-actions_test.cc index 275dbbf..2345a64 100644 --- a/test/gmock-actions_test.cc +++ b/test/gmock-actions_test.cc @@ -264,7 +264,7 @@ TEST(DefaultValueDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) { }, ""); } -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_UNIQUE_PTR_ TEST(DefaultValueDeathTest, GetWorksForMoveOnlyIfSet) { EXPECT_FALSE(DefaultValue<std::unique_ptr<int>>::Exists()); EXPECT_DEATH_IF_SUPPORTED({ @@ -277,7 +277,7 @@ TEST(DefaultValueDeathTest, GetWorksForMoveOnlyIfSet) { std::unique_ptr<int> i = DefaultValue<std::unique_ptr<int>>::Get(); EXPECT_EQ(42, *i); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_UNIQUE_PTR_ // Tests that DefaultValue<void>::Get() returns void. TEST(DefaultValueTest, GetWorksForVoid) { @@ -636,7 +636,7 @@ class MockClass { MOCK_METHOD1(IntFunc, int(bool flag)); // NOLINT MOCK_METHOD0(Foo, MyClass()); -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_UNIQUE_PTR_ MOCK_METHOD0(MakeUnique, std::unique_ptr<int>()); MOCK_METHOD0(MakeVectorUnique, std::vector<std::unique_ptr<int>>()); #endif @@ -1273,7 +1273,7 @@ TEST(ByRefTest, PrintsCorrectly) { EXPECT_EQ(expected.str(), actual.str()); } -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_UNIQUE_PTR_ std::unique_ptr<int> UniquePtrSource() { return std::unique_ptr<int>(new int(19)); @@ -1310,6 +1310,6 @@ TEST(MockMethodTest, CanReturnMoveOnlyValue) { EXPECT_EQ(7, *vresult[0]); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_UNIQUE_PTR_ } // Unnamed namespace diff --git a/test/gmock-generated-function-mockers_test.cc b/test/gmock-generated-function-mockers_test.cc index 14dded8..18f19d8 100644 --- a/test/gmock-generated-function-mockers_test.cc +++ b/test/gmock-generated-function-mockers_test.cc @@ -595,7 +595,7 @@ TEST(MockFunctionTest, WorksFor10Arguments) { EXPECT_EQ(2, foo.Call(true, 'a', 0, 0, 0, 0, 0, 'b', 1, false)); } -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ TEST(MockFunctionTest, AsStdFunction) { MockFunction<int(int)> foo; auto call = [](const std::function<int(int)> &f, int i) { @@ -606,7 +606,7 @@ TEST(MockFunctionTest, AsStdFunction) { EXPECT_EQ(-1, call(foo.AsStdFunction(), 1)); EXPECT_EQ(-2, call(foo.AsStdFunction(), 2)); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ } // namespace gmock_generated_function_mockers_test } // namespace testing diff --git a/test/gmock-matchers_test.cc b/test/gmock-matchers_test.cc index b44426e..c547622 100644 --- a/test/gmock-matchers_test.cc +++ b/test/gmock-matchers_test.cc @@ -54,7 +54,7 @@ #include "gtest/gtest.h" #include "gtest/gtest-spi.h" -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FORWARD_LIST_ # include <forward_list> // NOLINT #endif @@ -4545,7 +4545,7 @@ TEST(StreamlikeTest, Iteration) { } } -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FORWARD_LIST_ TEST(BeginEndDistanceIsTest, WorksWithForwardList) { std::forward_list<int> container; EXPECT_THAT(container, BeginEndDistanceIs(0)); @@ -4557,7 +4557,7 @@ TEST(BeginEndDistanceIsTest, WorksWithForwardList) { EXPECT_THAT(container, Not(BeginEndDistanceIs(0))); EXPECT_THAT(container, BeginEndDistanceIs(2)); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FORWARD_LIST_ TEST(BeginEndDistanceIsTest, WorksWithNonStdList) { const int a[5] = {1, 2, 3, 4, 5}; |