mirror of
https://github.com/google/googletest.git
synced 2024-12-26 17:41:03 +08:00
Make SizeIsMatcher::Impl conform to the contract of MatcherDescriberInterface.
MatcherDescriberInterface specifies that DescribeTo "should print a verb phrase", but "size ..." is not a verb phrase. Currently, ElementsAre(SizeIs(9)) is described as "has 1 element that size is equal to 9". With this change, it will be described as "has 1 element that has a size that is equal to 9". PiperOrigin-RevId: 492022324 Change-Id: I4083335f2419462464957521c1e033643b53b763
This commit is contained in:
parent
a16bfcfda1
commit
1f643f71d4
@ -2309,11 +2309,11 @@ class SizeIsMatcher {
|
||||
: size_matcher_(MatcherCast<SizeType>(size_matcher)) {}
|
||||
|
||||
void DescribeTo(::std::ostream* os) const override {
|
||||
*os << "size ";
|
||||
*os << "has a size that ";
|
||||
size_matcher_.DescribeTo(os);
|
||||
}
|
||||
void DescribeNegationTo(::std::ostream* os) const override {
|
||||
*os << "size ";
|
||||
*os << "has a size that ";
|
||||
size_matcher_.DescribeNegationTo(os);
|
||||
}
|
||||
|
||||
|
@ -1182,8 +1182,8 @@ TEST(SizeIsTest, WorksWithMinimalistCustomType) {
|
||||
|
||||
TEST(SizeIsTest, CanDescribeSelf) {
|
||||
Matcher<vector<int>> m = SizeIs(2);
|
||||
EXPECT_EQ("size is equal to 2", Describe(m));
|
||||
EXPECT_EQ("size isn't equal to 2", DescribeNegation(m));
|
||||
EXPECT_EQ("has a size that is equal to 2", Describe(m));
|
||||
EXPECT_EQ("has a size that isn't equal to 2", DescribeNegation(m));
|
||||
}
|
||||
|
||||
TEST(SizeIsTest, ExplainsResult) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user