Add a 3-arg overload for ResultOf() matcher that takes a description string for better error messages.
PiperOrigin-RevId: 427598749 Change-Id: I8c7a5d7b2dde017641534f1c7eed8dd56c33e845
This commit is contained in:
committed by
Copybara-Service
parent
06519cedc3
commit
0e402173c9
@@ -4643,6 +4643,16 @@ TEST(ResultOfTest, CanDescribeItself) {
|
||||
"isn't equal to \"foo\"", DescribeNegation(matcher));
|
||||
}
|
||||
|
||||
// Tests that ResultOf() can describe itself when provided a result description.
|
||||
TEST(ResultOfTest, CanDescribeItselfWithResultDescription) {
|
||||
Matcher<int> matcher =
|
||||
ResultOf("string conversion", &IntToStringFunction, StrEq("foo"));
|
||||
|
||||
EXPECT_EQ("whose string conversion is equal to \"foo\"", Describe(matcher));
|
||||
EXPECT_EQ("whose string conversion isn't equal to \"foo\"",
|
||||
DescribeNegation(matcher));
|
||||
}
|
||||
|
||||
// Tests that ResultOf() can explain the match result.
|
||||
int IntFunction(int input) { return input == 42 ? 80 : 90; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user