diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2010-01-28 21:52:29 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2010-01-28 21:52:29 +0000 |
commit | 74b72fc49e8da7185e78b121c78ddcab7f91e327 (patch) | |
tree | e3981d730d067cf6b5026c42e741ad0169835984 /test/gmock-generated-matchers_test.cc | |
parent | 775b12ebcec83b967501bf8b29f8e985a0651219 (diff) | |
download | googlemock-74b72fc49e8da7185e78b121c78ddcab7f91e327.tar.gz |
BREAKING CHANGE: drops the old matcher API. See http://code.google.com/p/googlemock/wiki/FrequentlyAskedQuestions for details.
git-svn-id: http://googlemock.googlecode.com/svn/trunk@265 8415998a-534a-0410-bf83-d39667b30386
Diffstat (limited to 'test/gmock-generated-matchers_test.cc')
-rw-r--r-- | test/gmock-generated-matchers_test.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/gmock-generated-matchers_test.cc b/test/gmock-generated-matchers_test.cc index 40c2367..5e14c42 100644 --- a/test/gmock-generated-matchers_test.cc +++ b/test/gmock-generated-matchers_test.cc @@ -68,6 +68,7 @@ using testing::Lt; using testing::MakeMatcher; using testing::Matcher; using testing::MatcherInterface; +using testing::MatchResultListener; using testing::Ne; using testing::Not; using testing::Pointee; @@ -217,21 +218,22 @@ class GreaterThanMatcher : public MatcherInterface<int> { public: explicit GreaterThanMatcher(int rhs) : rhs_(rhs) {} - virtual bool Matches(int lhs) const { return lhs > rhs_; } - virtual void DescribeTo(::std::ostream* os) const { *os << "is greater than " << rhs_; } - virtual void ExplainMatchResultTo(int lhs, ::std::ostream* os) const { + virtual bool MatchAndExplain(int lhs, + MatchResultListener* listener) const { const int diff = lhs - rhs_; if (diff > 0) { - *os << "is " << diff << " more than " << rhs_; + *listener << "is " << diff << " more than " << rhs_; } else if (diff == 0) { - *os << "is the same as " << rhs_; + *listener << "is the same as " << rhs_; } else { - *os << "is " << -diff << " less than " << rhs_; + *listener << "is " << -diff << " less than " << rhs_; } + + return lhs > rhs_; } private: |