use btctax_core::tax::return_inputs::ReturnInputs;
use btctax_core::tax::testonly::kitchen_sink_household;
const FIXTURE: &str = include_str!("fixtures/examples/fullreturn_inputs.toml");
#[test]
fn fullreturn_fixture_is_the_kitchen_sink_oracle() {
let parsed: ReturnInputs = toml::from_str(FIXTURE)
.expect("the committed fullreturn_inputs.toml parses as ReturnInputs");
assert_eq!(
parsed,
kitchen_sink_household().0,
"the committed J6 fixture must equal the kitchen_sink_household() oracle vector, verbatim — \
regenerate it with `cargo test -p btctax-cli --test fullreturn_oracle -- --ignored \
emit_fullreturn_fixture` if the oracle changed"
);
}
const FIXTURE_BANNER: &str = "\
# GENERATED — do not hand-edit. This is `btctax_core::tax::testonly::kitchen_sink_household()`'s
# ReturnInputs (`.0`) serialized to TOML; the J6 worked example imports it via `btctax income import`.
# The oracle test `fullreturn_oracle::fullreturn_fixture_is_the_kitchen_sink_oracle` pins it == the
# oracle vector. Regenerate with:
# cargo test -p btctax-cli --test fullreturn_oracle -- --ignored emit_fullreturn_fixture
# (keys sort alphabetically — that is the `toml::Value` table order, not a meaningful layout).
";
#[test]
#[ignore = "regeneration helper: rewrites the committed fullreturn_inputs.toml from the oracle"]
fn emit_fullreturn_fixture() {
let ri = kitchen_sink_household().0;
let value = toml::Value::try_from(&ri).expect("ReturnInputs → toml::Value");
let text = format!(
"{FIXTURE_BANNER}{}",
toml::to_string(&value).expect("toml::Value → TOML text")
);
let path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/fixtures/examples/fullreturn_inputs.toml"
);
std::fs::write(path, text).expect("write the committed fixture");
eprintln!("wrote {path}");
}