Skip to content

Commit 10c780e

Browse files
Merge pull request #357 from google:better_display
PiperOrigin-RevId: 603657369
2 parents 1862fe3 + 3f0b219 commit 10c780e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

googletest/src/matchers/display_matcher.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ impl<T: Debug + Display, InnerMatcher: Matcher<ActualT = String>> Matcher
4444
}
4545

4646
fn explain_match(&self, actual: &T) -> Description {
47-
format!("which displays as a string {}", self.inner.explain_match(&format!("{actual}")))
48-
.into()
47+
format!(
48+
"which displays as {:?} {}",
49+
actual.to_string(),
50+
self.inner.explain_match(&format!("{actual}"))
51+
)
52+
.into()
4953
}
5054

5155
fn describe(&self, matcher_result: MatcherResult) -> Description {
@@ -112,7 +116,7 @@ mod tests {
112116
err(displays_as(contains_substring(indoc!(
113117
"
114118
Actual: \"123\\n234\",
115-
which displays as a string which isn't equal to \"123\\n345\"
119+
which displays as \"123\\n234\" which isn't equal to \"123\\n345\"
116120
Difference(-actual / +expected):
117121
123
118122
-234

0 commit comments

Comments
 (0)