Skip to main content

regtest

Attribute Macro regtest 

Source
#[regtest]
Expand description

Attribute macro for regression tests.

This macro should be applied to test functions whose first argument is of type RegTest. It generates a #[test] function that automatically manages the file path for regression test data, creating the necessary directories and passing a RegTest instance to the test.

§Requirements

  • The first argument of the function must be of type RegTest.

§Example

use regression_test::RegTest;
use regression_test_macros::regtest;

#[regtest]
#[test]
fn my_test(mut rt: RegTest) {
    // Test logic
    rt.regtest("some output");
    rt.regtest_dbg(vec![1, 2, 3]);
}

The macro will inject code to determine the appropriate file path for the regression data, create the file if necessary, and pass a RegTest instance to the test function.