use fast_observe::{Fault, render_report};
fn boom() -> Fault {
Fault::from("source snippet boom")
}
#[test]
#[allow(
unsafe_code,
reason = "env mutation before the first render; this binary contains only this test"
)]
fn report_source_line_opt_in() {
unsafe {
std::env::set_var("OBSERVE_REPORT_SOURCE", "1");
}
let report = render_report(&boom());
let Some(source) = report.lines().find(|l| l.starts_with("source: ")) else {
unreachable!("no source line in report:\n{report}")
};
assert!(
source.contains("Fault::from(\"source snippet boom\")"),
"source line shows the constructing statement: {source}"
);
}