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:
@@ -214,7 +214,7 @@ class MyNonDefaultConstructible {
|
||||
int value_;
|
||||
};
|
||||
|
||||
#if GTEST_LANG_CXX11
|
||||
#if GTEST_HAS_STD_TYPE_TRAITS_
|
||||
|
||||
TEST(BuiltInDefaultValueTest, ExistsForDefaultConstructibleType) {
|
||||
EXPECT_TRUE(BuiltInDefaultValue<MyDefaultConstructible>::Exists());
|
||||
@@ -224,7 +224,7 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) {
|
||||
EXPECT_EQ(42, BuiltInDefaultValue<MyDefaultConstructible>::Get().value());
|
||||
}
|
||||
|
||||
#endif // GTEST_LANG_CXX11
|
||||
#endif // GTEST_HAS_STD_TYPE_TRAITS_
|
||||
|
||||
TEST(BuiltInDefaultValueTest, DoesNotExistForNonDefaultConstructibleType) {
|
||||
EXPECT_FALSE(BuiltInDefaultValue<MyNonDefaultConstructible>::Exists());
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user