mirror of
https://github.com/google/googletest.git
synced 2024-12-30 21:23:01 +08:00
commit
2a151c93c1
@ -4529,6 +4529,20 @@ Property(PropertyType (Class::*property)() const &,
|
|||||||
property,
|
property,
|
||||||
MatcherCast<GTEST_REFERENCE_TO_CONST_(PropertyType)>(matcher)));
|
MatcherCast<GTEST_REFERENCE_TO_CONST_(PropertyType)>(matcher)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Three-argument form for reference-qualified member functions.
|
||||||
|
template <typename Class, typename PropertyType, typename PropertyMatcher>
|
||||||
|
inline PolymorphicMatcher<internal::PropertyMatcher<
|
||||||
|
Class, PropertyType, PropertyType (Class::*)() const &> >
|
||||||
|
Property(const std::string& property_name,
|
||||||
|
PropertyType (Class::*property)() const &,
|
||||||
|
const PropertyMatcher& matcher) {
|
||||||
|
return MakePolymorphicMatcher(
|
||||||
|
internal::PropertyMatcher<Class, PropertyType,
|
||||||
|
PropertyType (Class::*)() const &>(
|
||||||
|
property_name, property,
|
||||||
|
MatcherCast<GTEST_REFERENCE_TO_CONST_(PropertyType)>(matcher)));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Creates a matcher that matches an object iff the result of applying
|
// Creates a matcher that matches an object iff the result of applying
|
||||||
|
@ -2795,7 +2795,6 @@ TEST(ElementsAreTest, HugeMatcherUnordered) {
|
|||||||
|
|
||||||
#endif // GTEST_LANG_CXX11
|
#endif // GTEST_LANG_CXX11
|
||||||
|
|
||||||
|
|
||||||
// Tests that AnyOf(m1, ..., mn) describes itself properly.
|
// Tests that AnyOf(m1, ..., mn) describes itself properly.
|
||||||
TEST(AnyOfTest, CanDescribeSelf) {
|
TEST(AnyOfTest, CanDescribeSelf) {
|
||||||
Matcher<int> m;
|
Matcher<int> m;
|
||||||
@ -4239,13 +4238,17 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) {
|
|||||||
// ref-qualified.
|
// ref-qualified.
|
||||||
TEST(PropertyTest, WorksForRefQualifiedProperty) {
|
TEST(PropertyTest, WorksForRefQualifiedProperty) {
|
||||||
Matcher<const AClass&> m = Property(&AClass::s_ref, StartsWith("hi"));
|
Matcher<const AClass&> m = Property(&AClass::s_ref, StartsWith("hi"));
|
||||||
|
Matcher<const AClass&> m_with_name =
|
||||||
|
Property("s", &AClass::s_ref, StartsWith("hi"));
|
||||||
|
|
||||||
AClass a;
|
AClass a;
|
||||||
a.set_s("hill");
|
a.set_s("hill");
|
||||||
EXPECT_TRUE(m.Matches(a));
|
EXPECT_TRUE(m.Matches(a));
|
||||||
|
EXPECT_TRUE(m_with_name.Matches(a));
|
||||||
|
|
||||||
a.set_s("hole");
|
a.set_s("hole");
|
||||||
EXPECT_FALSE(m.Matches(a));
|
EXPECT_FALSE(m.Matches(a));
|
||||||
|
EXPECT_FALSE(m_with_name.Matches(a));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -522,11 +522,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
|||||||
#endif // !defined(GTEST_HAS_STD_STRING)
|
#endif // !defined(GTEST_HAS_STD_STRING)
|
||||||
|
|
||||||
#ifndef GTEST_HAS_GLOBAL_STRING
|
#ifndef GTEST_HAS_GLOBAL_STRING
|
||||||
// The user didn't tell us whether ::string is available, so we need
|
|
||||||
// to figure it out.
|
|
||||||
|
|
||||||
# define GTEST_HAS_GLOBAL_STRING 0
|
# define GTEST_HAS_GLOBAL_STRING 0
|
||||||
|
|
||||||
#endif // GTEST_HAS_GLOBAL_STRING
|
#endif // GTEST_HAS_GLOBAL_STRING
|
||||||
|
|
||||||
#ifndef GTEST_HAS_STD_WSTRING
|
#ifndef GTEST_HAS_STD_WSTRING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user