pub struct RegTest { /* private fields */ }Expand description
RegTest is a utility for regression testing by recording and comparing test outputs.
This struct manages regression test data in two modes:
- Write mode: Captures and stores test output data to a file for future regression runs.
- Read mode: Loads previously recorded regression data and compares it with current test output, reporting any mismatches or differences.
§Usage
- Use
RegTest::newto create a new instance, specifying the file path for regression data. - Use [
regtest] and [regtest_dbg] methods to record or compare values in Display or Debug format. - When dropped, if in write mode, the struct writes all buffered entries to the specified file.
§Example
use regression_test::RegTest;
let mut regtest = RegTest::new("./regtest_data/regression.json").unwrap();
regtest.regtest("some output");
regtest.regtest_dbg(vec![1, 2, 3]);
// Data is written to file when regtest goes out of scope.Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RegTest
impl RefUnwindSafe for RegTest
impl Send for RegTest
impl Sync for RegTest
impl Unpin for RegTest
impl UnsafeUnpin for RegTest
impl UnwindSafe for RegTest
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