use crate::{track_error, Track, Tracked};
fn error_func() -> Result<(), String> {
Err("something went wrong".to_string())
}
fn track_result() -> Result<(), Tracked<String>> {
error_func().track()?;
Ok(())
}
fn track_macro() -> Result<(), Tracked<String>> {
let _ = error_func().map_err(|e| track_error!(e))?;
Ok(())
}
#[test]
fn test_track_loaction() {
if let Err(e) = track_result() {
println!("Error: {}", e);
println!("Location: {}:{}", e.location().0, e.location().1);
}
}
#[test]
fn test_track_macro() {
if let Err(e) = track_macro() {
println!("Error: {}", e);
println!("Location: {}:{}", e.location().0, e.location().1);
}
}