pub struct Harness<S, T, I, E> { /* private fields */ }Expand description
Harness for discovering test inputs and asserting against snapshot files
Implementations§
Source§impl<S, T, I, E> Harness<S, T, I, E>
impl<S, T, I, E> Harness<S, T, I, E>
Sourcepub fn new(input_root: impl Into<PathBuf>, setup: S, test: T) -> Self
pub fn new(input_root: impl Into<PathBuf>, setup: S, test: T) -> Self
Specify where the test scenarios
input_root: where to find the files. SeeSelf::selectfor restricting what files are consideredsetup: Given a path, choose the test name and the output locationtest: Given a path, return the actual output value
By default filters are applied, including:
...is a line-wildcard when on a line by itself[..]is a character-wildcard when inside a line[EXE]matches.exeon Windows"{...}"is a JSON value wildcard"...": "{...}"is a JSON key-value wildcard\to/- Newlines
To limit this to newline normalization for text, have Setup call Data::raw on expected.
Sourcepub fn select<'p>(self, patterns: impl IntoIterator<Item = &'p str>) -> Self
pub fn select<'p>(self, patterns: impl IntoIterator<Item = &'p str>) -> Self
Path patterns for selecting input files
This uses gitignore syntax
Sourcepub fn with_assert(self, config: Assert) -> Self
pub fn with_assert(self, config: Assert) -> Self
Customize the assertion behavior
Includes
- Configuring redactions
- Override updating environment vaeiable
Auto Trait Implementations§
impl<S, T, I, E> Freeze for Harness<S, T, I, E>
impl<S, T, I, E> RefUnwindSafe for Harness<S, T, I, E>
impl<S, T, I, E> Send for Harness<S, T, I, E>
impl<S, T, I, E> Sync for Harness<S, T, I, E>
impl<S, T, I, E> Unpin for Harness<S, T, I, E>
impl<S, T, I, E> UnwindSafe for Harness<S, T, I, E>
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
Mutably borrows from an owned value. Read more