diff options
author | Abseil Team <absl-team@google.com> | 2020-02-25 15:52:53 (GMT) |
---|---|---|
committer | CJ Johnson <johnsoncj@google.com> | 2020-02-28 21:08:23 (GMT) |
commit | 75feebda2fc1be30af1020341d7fba20b52086dc (patch) | |
tree | eea1e402de2fe2ae0bbb370cbe68f3019efcc063 /googlemock/test | |
parent | c91425824110ca94dd6942cd31cb6c77c46a7b8a (diff) | |
download | googletest-75feebda2fc1be30af1020341d7fba20b52086dc.zip googletest-75feebda2fc1be30af1020341d7fba20b52086dc.tar.gz googletest-75feebda2fc1be30af1020341d7fba20b52086dc.tar.bz2 |
Export Test - Do Not Merge
Relax the implementation of MatcherCast to allow conversion of `Matcher<T>` to
`Matcher<const T&>`. They have the same match signature.
PiperOrigin-RevId: 297115843
Diffstat (limited to 'googlemock/test')
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index c1949e6..3619959 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -765,10 +765,11 @@ TEST(SafeMatcherCastTest, FromConstReferenceToReference) { // Tests that MatcherCast<const T&>(m) works when m is a Matcher<T>. TEST(SafeMatcherCastTest, FromNonReferenceToConstReference) { - Matcher<int> m1 = Eq(0); - Matcher<const int&> m2 = SafeMatcherCast<const int&>(m1); - EXPECT_TRUE(m2.Matches(0)); - EXPECT_FALSE(m2.Matches(1)); + Matcher<std::unique_ptr<int>> m1 = IsNull(); + Matcher<const std::unique_ptr<int>&> m2 = + SafeMatcherCast<const std::unique_ptr<int>&>(m1); + EXPECT_TRUE(m2.Matches(std::unique_ptr<int>())); + EXPECT_FALSE(m2.Matches(std::unique_ptr<int>(new int))); } // Tests that SafeMatcherCast<T&>(m) works when m is a Matcher<T>. |