Skip to main content

Crate regression_test_macros

Crate regression_test_macros 

Source
Expand description

§regression-test-macros

This crate provides procedural macros to support regression testing in Rust projects. The main macro, regtest, is an attribute macro designed to be applied to test functions. It automatically generates boilerplate code for managing regression test data files, ensuring that each test has a dedicated file for storing and comparing results.

§Features

  • Automatically determines and creates the appropriate file path for regression data based on the test’s source location (unit or integration test).
  • Handles compatibility with tools like rust-analyzer.

§Usage

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

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

The macro will ensure that a regression data file is created and passed to the test via the RegTest argument.

Attribute Macros§

regtest
Attribute macro for regression tests.