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