pub struct Diff {
expected: Option<String>,
expected_name: Option<String>,
expected_file: Option<PathBuf>,
actual: Option<String>,
actual_name: Option<String>,
normalizers: Vec<(String, String)>,
drop_bomb: DropBomb,
}
Fields§
§expected: Option<String>
§expected_name: Option<String>
§expected_file: Option<PathBuf>
§actual: Option<String>
§actual_name: Option<String>
§normalizers: Vec<(String, String)>
§drop_bomb: DropBomb
Implementations§
Source§impl Diff
impl Diff
Sourcepub fn expected_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn expected_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Specify the expected output for the diff from a file.
Sourcepub fn expected_text<T: AsRef<[u8]>>(
&mut self,
name: &str,
text: T,
) -> &mut Self
pub fn expected_text<T: AsRef<[u8]>>( &mut self, name: &str, text: T, ) -> &mut Self
Specify the expected output for the diff from a given text string.
Sourcepub fn actual_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn actual_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Specify the actual output for the diff from a file.
Sourcepub fn actual_text<T: AsRef<[u8]>>(&mut self, name: &str, text: T) -> &mut Self
pub fn actual_text<T: AsRef<[u8]>>(&mut self, name: &str, text: T) -> &mut Self
Specify the actual output for the diff from a given text string.
Sourcepub fn normalize<R: Into<String>, I: Into<String>>(
&mut self,
regex: R,
replacement: I,
) -> &mut Self
pub fn normalize<R: Into<String>, I: Into<String>>( &mut self, regex: R, replacement: I, ) -> &mut Self
Specify a regex that should replace text in the “actual” text that will be compared.
fn run_common(&self) -> (&str, &str, String, String)
pub fn run(&mut self)
pub fn run_fail(&mut self)
Sourcefn maybe_bless_expected_file(&self, actual: &str) -> bool
fn maybe_bless_expected_file(&self, actual: &str) -> bool
If we have an expected file to write into, and RUSTC_BLESS_TEST
is
set, then write the actual output into the file and return true
.
We assume that RUSTC_BLESS_TEST
contains the path to the original test’s
source directory. That lets us bless the original snapshot file in the
source tree, not the copy in rmake_out
that we would normally use.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Diff
impl RefUnwindSafe for Diff
impl Send for Diff
impl Sync for Diff
impl Unpin for Diff
impl UnwindSafe for Diff
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 200 bytes