use subject_source::errors::result; #[test] pub fn is_err_err() { assert!(result::is_err(&Err("oh no"))); } #[test] pub fn is_err_ok() { assert!(!result::is_err(&Ok(420))); } #[test] pub fn is_ok_err() { assert!(!result::is_ok(&Err("oh no"))); } #[test] pub fn is_ok_ok() { assert!(result::is_ok(&Ok(420))); } #[test] pub fn get_err_or_panic_err() { assert_eq!(result::get_err_or_panic(Err("ayaya")), "ayaya"); } #[test] #[should_panic] pub fn get_err_or_panic_ok() { let _ = std::hint::black_box(result::get_err_or_panic(Ok(10))); } #[test] pub fn get_val_or_panic_ok() { assert_eq!(result::get_val_or_panic(Ok(10)), 10); } #[test] #[should_panic] pub fn get_val_or_panic_err() { let _ = std::hint::black_box(result::get_val_or_panic(Err("oaizjd"))); } #[test] pub fn discard_err_err() { assert_eq!(result::discard_err(Err("hello")), None); } #[test] pub fn discard_err_ok() { assert_eq!(result::discard_err(Ok(128)), Some(128)); }