Skip to content

Commit

Permalink
Merge pull request #326 from google:use-description-for-structured-ou…
Browse files Browse the repository at this point in the history
…tput

PiperOrigin-RevId: 595943355
  • Loading branch information
copybara-github committed Jan 5, 2024
2 parents 41127ca + 3edb5e6 commit 147862d
Show file tree
Hide file tree
Showing 58 changed files with 1,853 additions and 1,032 deletions.
24 changes: 12 additions & 12 deletions googletest/crate_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ a struct holding the matcher's data and have it implement the trait
[`Matcher`]:

```no_run
use googletest::matcher::{Matcher, MatcherResult};
use googletest::{description::Description, matcher::{Matcher, MatcherResult}};
use std::fmt::Debug;
struct MyEqMatcher<T> {
Expand All @@ -227,13 +227,13 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
}
}
fn describe(&self, matcher_result: MatcherResult) -> String {
fn describe(&self, matcher_result: MatcherResult) -> Description {
match matcher_result {
MatcherResult::Match => {
format!("is equal to {:?} the way I define it", self.expected)
format!("is equal to {:?} the way I define it", self.expected).into()
}
MatcherResult::NoMatch => {
format!("isn't equal to {:?} the way I define it", self.expected)
format!("isn't equal to {:?} the way I define it", self.expected).into()
}
}
}
Expand All @@ -243,7 +243,7 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
It is recommended to expose a function which constructs the matcher:

```no_run
# use googletest::matcher::{Matcher, MatcherResult};
# use googletest::{description::Description, matcher::{Matcher, MatcherResult}};
# use std::fmt::Debug;
#
# struct MyEqMatcher<T> {
Expand All @@ -261,13 +261,13 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
# }
# }
#
# fn describe(&self, matcher_result: MatcherResult) -> String {
# fn describe(&self, matcher_result: MatcherResult) -> Description {
# match matcher_result {
# MatcherResult::Match => {
# format!("is equal to {:?} the way I define it", self.expected)
# format!("is equal to {:?} the way I define it", self.expected).into()
# }
# MatcherResult::NoMatch => {
# format!("isn't equal to {:?} the way I define it", self.expected)
# format!("isn't equal to {:?} the way I define it", self.expected).into()
# }
# }
# }
Expand All @@ -282,7 +282,7 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {

```
# use googletest::prelude::*;
# use googletest::matcher::{Matcher, MatcherResult};
# use googletest::{description::Description, matcher::{Matcher, MatcherResult}};
# use std::fmt::Debug;
#
# struct MyEqMatcher<T> {
Expand All @@ -300,13 +300,13 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
# }
# }
#
# fn describe(&self, matcher_result: MatcherResult) -> String {
# fn describe(&self, matcher_result: MatcherResult) -> Description {
# match matcher_result {
# MatcherResult::Match => {
# format!("is equal to {:?} the way I define it", self.expected)
# format!("is equal to {:?} the way I define it", self.expected).into()
# }
# MatcherResult::NoMatch => {
# format!("isn't equal to {:?} the way I define it", self.expected)
# format!("isn't equal to {:?} the way I define it", self.expected).into()
# }
# }
# }
Expand Down
Loading

0 comments on commit 147862d

Please sign in to comment.