use super::super::*;
#[test]
fn test_basic_error() {
let resp: Result<()> = Err("test error".into());
assert!(resp.is_err());
assert_eq!(resp.err().unwrap().to_string(), "test error");
}
#[test]
fn test_try_catch() {
let resp = try_catch(|| Ok(()));
assert!(resp.is_ok());
let resp = try_catch(|| Err("test error".into()));
assert!(resp.is_err());
assert_eq!(resp.err().unwrap().to_string(), "test error");
let resp = try_catch(|| {
panic!("test panic");
#[allow(unreachable_code)]
Ok(())
});
assert!(resp.is_err());
assert_eq!(resp.err().unwrap().to_string(), "test panic");
}