run_make_support::diff

Struct Diff

Source
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

Source

pub fn new() -> Self

Construct a bare diff invocation.

Source

pub fn expected_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Specify the expected output for the diff from a file.

Source

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.

Source

pub fn actual_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Specify the actual output for the diff from a file.

Source

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.

Source

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.

Source

fn run_common(&self) -> (&str, &str, String, String)

Source

pub fn run(&mut self)

Source

pub fn run_fail(&mut self)

Source

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§

Source§

impl Debug for Diff

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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