googlemock: Disable WhenDynamicCastToTest tests when RTTI is off

https://github.com/google/googletest/issues/610
This commit is contained in:
Mark Mentovai 2015-10-12 18:01:43 -04:00
parent 7f4448f40b
commit c8a1050704

View File

@ -3179,6 +3179,8 @@ MATCHER_P(FieldIIs, inner_matcher, "") {
return ExplainMatchResult(inner_matcher, arg.i, result_listener); return ExplainMatchResult(inner_matcher, arg.i, result_listener);
} }
#if GTEST_HAS_RTTI
TEST(WhenDynamicCastToTest, SameType) { TEST(WhenDynamicCastToTest, SameType) {
Derived derived; Derived derived;
derived.i = 4; derived.i = 4;
@ -3236,12 +3238,8 @@ TEST(WhenDynamicCastToTest, AmbiguousCast) {
TEST(WhenDynamicCastToTest, Describe) { TEST(WhenDynamicCastToTest, Describe) {
Matcher<Base*> matcher = WhenDynamicCastTo<Derived*>(Pointee(_)); Matcher<Base*> matcher = WhenDynamicCastTo<Derived*>(Pointee(_));
#if GTEST_HAS_RTTI
const string prefix = const string prefix =
"when dynamic_cast to " + internal::GetTypeName<Derived*>() + ", "; "when dynamic_cast to " + internal::GetTypeName<Derived*>() + ", ";
#else // GTEST_HAS_RTTI
const string prefix = "when dynamic_cast, ";
#endif // GTEST_HAS_RTTI
EXPECT_EQ(prefix + "points to a value that is anything", Describe(matcher)); EXPECT_EQ(prefix + "points to a value that is anything", Describe(matcher));
EXPECT_EQ(prefix + "does not point to a value that is anything", EXPECT_EQ(prefix + "does not point to a value that is anything",
DescribeNegation(matcher)); DescribeNegation(matcher));
@ -3275,6 +3273,8 @@ TEST(WhenDynamicCastToTest, BadReference) {
EXPECT_THAT(as_base_ref, Not(WhenDynamicCastTo<const OtherDerived&>(_))); EXPECT_THAT(as_base_ref, Not(WhenDynamicCastTo<const OtherDerived&>(_)));
} }
#endif // GTEST_HAS_RTTI
// Minimal const-propagating pointer. // Minimal const-propagating pointer.
template <typename T> template <typename T>
class ConstPropagatingPtr { class ConstPropagatingPtr {