use rstest::rstest; use std::convert::Infallible; use std::fmt::Debug; use tailsome::IntoResult; #[derive(Clone, Debug, PartialEq)] struct Thing; #[rstest] #[case(())] #[case(42)] #[case(Thing)] #[case("a str")] #[case(Some(Thing))] fn anything_can_be_ok(#[case] anything: T) { match anything.clone().into_ok::() { Ok(thing) => assert_eq!(thing, anything), Err(_) => unreachable!(), } } #[rstest] #[case(())] #[case(42)] #[case(Thing)] #[case("a str")] #[case(Some(Thing))] fn anything_can_be_err(#[case] anything: T) { match anything.clone().into_err::<()>() { Err(thing) => assert_eq!(thing, anything), Ok(_) => unreachable!(), } }