use std::io;
use thistrace::{traceable, HasTrace};
#[traceable]
#[derive(thiserror::Error, Debug)]
enum AppError {
#[error("io")]
Io(#[from] io::Error, std::path::PathBuf),
}
fn inner() -> Result<(), io::Error> {
Err(io::Error::new(io::ErrorKind::Other, "boom"))
}
fn outer() -> Result<(), AppError> {
inner()?;
Ok(())
}
#[test]
fn tuple_variant_with_context_compiles_and_captures_trace() {
let err = outer().unwrap_err();
let trace = err.trace().expect("trace should exist");
assert_eq!(trace.frames().len(), 1);
assert!(trace.frames()[0]
.file
.ends_with("tuple_variant_with_context.rs"));
}