googlemock: Support C++11 language with pre-C++11 library

This guards use of <type_traits> and its features with
GTEST_HAS_STD_TYPE_TRAITS_, and std::function with
GTEST_HAS_STD_FUNCTION_.
This commit is contained in:
Mark Mentovai
2015-10-12 17:57:51 -04:00
parent 7f4448f40b
commit a0435dc687
4 changed files with 12 additions and 11 deletions

View File

@@ -1042,14 +1042,14 @@ TEST(IsNullTest, ReferenceToConstLinkedPtr) {
EXPECT_FALSE(m.Matches(non_null_p));
}
#if GTEST_LANG_CXX11
#if GTEST_HAS_STD_FUNCTION_
TEST(IsNullTest, StdFunction) {
const Matcher<std::function<void()>> m = IsNull();
EXPECT_TRUE(m.Matches(std::function<void()>()));
EXPECT_FALSE(m.Matches([]{}));
}
#endif // GTEST_LANG_CXX11
#endif // GTEST_HAS_STD_FUNCTION_
// Tests that IsNull() describes itself properly.
TEST(IsNullTest, CanDescribeSelf) {
@@ -1090,14 +1090,14 @@ TEST(NotNullTest, ReferenceToConstLinkedPtr) {
EXPECT_TRUE(m.Matches(non_null_p));
}
#if GTEST_LANG_CXX11
#if GTEST_HAS_STD_FUNCTION_
TEST(NotNullTest, StdFunction) {
const Matcher<std::function<void()>> m = NotNull();
EXPECT_TRUE(m.Matches([]{}));
EXPECT_FALSE(m.Matches(std::function<void()>()));
}
#endif // GTEST_LANG_CXX11
#endif // GTEST_HAS_STD_FUNCTION_
// Tests that NotNull() describes itself properly.
TEST(NotNullTest, CanDescribeSelf) {