mod into;
pub use into::*;

mod from;
pub use from::*;

mod function;
pub use function::*;

#[cfg(test)]
mod tests {
    use super::*;
    use crate::{Context, ContextRef, Runtime};

    fn check_round_trip<T>(ctx: &ContextRef, v: T)
    where
        T: TryIntoValue + TryFromValue + PartialEq + Clone + std::fmt::Debug,
    {
        let val = v.clone().try_into_value(ctx).expect("Could not make value");
        let new = T::try_from_value(&val, ctx).expect("Could not unwrap value");
        assert_eq!(v, new);
    }

    #[test]
    fn round_trip() {
        let ctx = Context::new(Runtime::new());
        check_round_trip(&ctx, true);
        check_round_trip(&ctx, false);
        check_round_trip(&ctx, 12);
    }
}
