pub struct ExpectedErrorMessageBuilder<'a> { /* private fields */ }test-util only.Expand description
Builder struct for ExpectedErrorMessage
Implementations§
Source§impl<'a> ExpectedErrorMessageBuilder<'a>
impl<'a> ExpectedErrorMessageBuilder<'a>
Sourcepub fn error(msg: &'a str) -> Self
pub fn error(msg: &'a str) -> Self
Create a builder expecting the given main error message (contents of
Display)
Sourcepub fn error_starts_with(msg: &'a str) -> Self
pub fn error_starts_with(msg: &'a str) -> Self
Create a builder expecting the main error message (contents of
Display) to start with the given text.
(If you later add expected help text to this builder, that will also be an expected prefix, not the entire expected help text.)
Sourcepub fn help(self, msg: &'a str) -> Self
pub fn help(self, msg: &'a str) -> Self
Add expected contents of help(), or expected prefix of help() if
this builder was originally constructed with error_starts_with()
Sourcepub fn exactly_one_underline(self, snippet: &'a str) -> Self
pub fn exactly_one_underline(self, snippet: &'a str) -> Self
Add expected underlined text. The error message will be expected to have
exactly one miette label, and the underlined portion should be snippet.
The underlined text should have no associated label text.
Sourcepub fn exactly_one_underline_with_label(
self,
snippet: &'a str,
label: &'a str,
) -> Self
pub fn exactly_one_underline_with_label( self, snippet: &'a str, label: &'a str, ) -> Self
Add expected underlined text. The error message will be expected to have
exactly one miette label, and the underlined portion should be snippet.
The label text is expected to match label.
Sourcepub fn exactly_two_underlines(
self,
snippet1: &'a str,
snippet2: &'a str,
) -> Self
pub fn exactly_two_underlines( self, snippet1: &'a str, snippet2: &'a str, ) -> Self
Add expected underlined text. The error message will be expected to have
exactly two miette labels, and the underlined portions should be snippet1
and snippet2, in that order.
Both labels should have no associated label text.
Sourcepub fn with_underlines_or_labels(
self,
labels: impl IntoIterator<Item = (&'a str, Option<&'a str>)>,
) -> Self
pub fn with_underlines_or_labels( self, labels: impl IntoIterator<Item = (&'a str, Option<&'a str>)>, ) -> Self
Add expected underlined text. The error message will be expected to have
exactly this many miette labels, and for each label (a, b), the underlined
portion should be a and the label text should be b (or None for no
label text).
Sourcepub fn source(self, msg: &'a str) -> Self
pub fn source(self, msg: &'a str) -> Self
Add expected contents of source(), or expected prefix of source() if
this builder was originally constructed with error_starts_with()
Sourcepub fn build(self) -> ExpectedErrorMessage<'a>
pub fn build(self) -> ExpectedErrorMessage<'a>
Build the ExpectedErrorMessage
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ExpectedErrorMessageBuilder<'a>
impl<'a> RefUnwindSafe for ExpectedErrorMessageBuilder<'a>
impl<'a> Send for ExpectedErrorMessageBuilder<'a>
impl<'a> Sync for ExpectedErrorMessageBuilder<'a>
impl<'a> Unpin for ExpectedErrorMessageBuilder<'a>
impl<'a> UnsafeUnpin for ExpectedErrorMessageBuilder<'a>
impl<'a> UnwindSafe for ExpectedErrorMessageBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more