tor-error: tests: Add a test case for Report and Bug wrapping

This commit is contained in:
Ian Jackson 2022-12-14 14:05:46 +00:00
parent 4181ccb8cc
commit 8a28cb2d14
1 changed files with 11 additions and 0 deletions

View File

@ -291,6 +291,17 @@ mod test {
assert!(s.contains("Couldn't wobble the wobbling device."));
#[cfg(feature = "backtrace")]
assert!(s.contains("internal_macro_test"));
#[derive(thiserror::Error, Debug)]
enum Wrap {
#[error("Internal error")]
Internal(#[from] Bug),
}
let w: Wrap = e.into();
let s = format!("Got: {}", w.report());
dbg!(&s);
assert!(s.contains("Couldn't wobble the wobbling device."));
}
#[test]