mod helper;
use helper::{
TestEnum,
TestEnum::{Int, Unit},
};
#[test]
#[allow(deprecated)] fn single_value_tuple_deprecated() {
assert_eq!(Int(123).ok_or_int("ERR").unwrap(), 123);
assert_eq!(Unit.ok_or_int("ERR").unwrap_err(), "ERR");
}
#[test]
#[allow(deprecated)] fn multi_value_tuple_deprecated() {
assert_eq!(
TestEnum::new_tuple(123).ok_or_tuple("ERR").unwrap(),
("123".into(), 123)
);
assert_eq!(Unit.ok_or_tuple("ERR").unwrap_err(), "ERR");
}
#[test]
fn single_value_tuple() {
assert_eq!(Int(123).int_or("ERR").unwrap(), 123);
assert_eq!(Unit.int_or("ERR").unwrap_err(), "ERR");
}
#[test]
fn multi_value_tuple() {
assert_eq!(
TestEnum::new_tuple(123).tuple_or("ERR").unwrap(),
("123".into(), 123)
);
assert_eq!(Unit.tuple_or("ERR").unwrap_err(), "ERR");
}