pub fn compare_or_save_testdata<T>(filename: &str, output: &T)
Expand description
Compares or saves the execution output to a testdata file.
This utility helps maintain consistent test behavior by comparing execution results against known-good outputs stored in JSON files.
§Arguments
filename
- The name of the testdata file, relative to tests/testdata/output
- The execution output to compare or save
§Panics
This function panics if:
- The output doesn’t match the expected testdata (when testdata file exists)
- There’s an error reading/writing files
- JSON serialization/deserialization fails
§Note
Tests using this function require the serde
feature to be enabled:
cargo test --features serde