aboutsummaryrefslogtreecommitdiffstats
path: root/test/gmock-generated-matchers_test.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2010-01-28 21:52:29 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2010-01-28 21:52:29 +0000
commitdb22c227826b82e1ad05d6c47facfef73c99e057 (patch)
treee3981d730d067cf6b5026c42e741ad0169835984 /test/gmock-generated-matchers_test.cc
parent99643d2d1fb3e632955b34c453ac6f731285e379 (diff)
downloadgoogletest-db22c227826b82e1ad05d6c47facfef73c99e057.tar.gz
googletest-db22c227826b82e1ad05d6c47facfef73c99e057.tar.bz2
googletest-db22c227826b82e1ad05d6c47facfef73c99e057.zip
BREAKING CHANGE: drops the old matcher API. See http://code.google.com/p/googlemock/wiki/FrequentlyAskedQuestions for details.
Diffstat (limited to 'test/gmock-generated-matchers_test.cc')
-rw-r--r--test/gmock-generated-matchers_test.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/gmock-generated-matchers_test.cc b/test/gmock-generated-matchers_test.cc
index 40c2367c..5e14c42a 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: