aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock-matchers_test.cc
diff options
context:
space:
mode:
authorTanzinul Islam <t_17_7@hotmail.com>2017-09-06 01:05:24 +0100
committerTanzinul Islam <t_17_7@hotmail.com>2017-09-06 01:05:24 +0100
commit78b1ff074799c776f90a77203fcd7adc98e11736 (patch)
tree21974f2d4f0d4aeaff5a4027df84889a2619ae25 /googlemock/test/gmock-matchers_test.cc
parenta838de3348add7530431e8d91c8a66cc646f1888 (diff)
parent857ddeadebe4aa75efcee728651d0947a5a1065a (diff)
downloadgoogletest-78b1ff074799c776f90a77203fcd7adc98e11736.tar.gz
googletest-78b1ff074799c776f90a77203fcd7adc98e11736.tar.bz2
googletest-78b1ff074799c776f90a77203fcd7adc98e11736.zip
Merge branch 'master' into fix_death_test_child_mingw_wer_issue1116
Diffstat (limited to 'googlemock/test/gmock-matchers_test.cc')
-rw-r--r--googlemock/test/gmock-matchers_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc
index f5ab7c81..fc867487 100644
--- a/googlemock/test/gmock-matchers_test.cc
+++ b/googlemock/test/gmock-matchers_test.cc
@@ -3588,10 +3588,15 @@ class AClass {
// A getter that returns a reference to const.
const std::string& s() const { return s_; }
+#if GTEST_LANG_CXX11
+ const std::string& s_ref() const & { return s_; }
+#endif
+
void set_s(const std::string& new_s) { s_ = new_s; }
// A getter that returns a reference to non-const.
double& x() const { return x_; }
+
private:
int n_;
std::string s_;
@@ -3635,6 +3640,21 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) {
EXPECT_FALSE(m.Matches(a));
}
+#if GTEST_LANG_CXX11
+// Tests that Property(&Foo::property, ...) works when property() is
+// ref-qualified.
+TEST(PropertyTest, WorksForRefQualifiedProperty) {
+ Matcher<const AClass&> m = Property(&AClass::s_ref, StartsWith("hi"));
+
+ AClass a;
+ a.set_s("hill");
+ EXPECT_TRUE(m.Matches(a));
+
+ a.set_s("hole");
+ EXPECT_FALSE(m.Matches(a));
+}
+#endif
+
// Tests that Property(&Foo::property, ...) works when property()
// returns a reference to non-const.
TEST(PropertyTest, WorksForReferenceToNonConstProperty) {