Use ResultOf()'s result_description when explaining match result.
PiperOrigin-RevId: 439389646 Change-Id: Ie34adcdd2b24378e85962efac53b7bb89ed93803
This commit is contained in:
committed by
Copybara-Service
parent
25dcdc7e8b
commit
3ffa237f0e
@@ -949,6 +949,17 @@ TEST(ResultOfTest, CanExplainMatchResult) {
|
||||
Explain(matcher, 36));
|
||||
}
|
||||
|
||||
TEST(ResultOfTest, CanExplainMatchResultWithResultDescription) {
|
||||
Matcher<int> matcher = ResultOf("magic int conversion", &IntFunction, Ge(85));
|
||||
EXPECT_EQ("whose magic int conversion is 90" + OfType("int"),
|
||||
Explain(matcher, 36));
|
||||
|
||||
matcher = ResultOf("magic int conversion", &IntFunction, GreaterThan(85));
|
||||
EXPECT_EQ("whose magic int conversion is 90" + OfType("int") +
|
||||
", which is 5 more than 85",
|
||||
Explain(matcher, 36));
|
||||
}
|
||||
|
||||
// Tests that ResultOf(f, ...) compiles and works as expected when f(x)
|
||||
// returns a non-reference.
|
||||
TEST(ResultOfTest, WorksForNonReferenceResults) {
|
||||
|
||||
Reference in New Issue
Block a user