use super::Connected;
struct Manager {
root: &'static str,
}
#[test]
fn a_bundle_hands_back_both_halves() {
let manager = Manager { root: "/var/blobs" };
let ctx = Connected::new(&manager, 7u32);
assert_eq!(ctx.connection().root, "/var/blobs");
assert_eq!(*ctx.scope(), 7);
assert_eq!(ctx.into_scope(), 7);
}
#[test]
fn the_connection_survives_the_bundle_it_came_from() {
let manager = Manager { root: "/srv" };
let (conn, scope): (&Manager, ()) = Connected::new(&manager, ()).into_parts();
assert_eq!(conn.root, "/srv");
assert_eq!(scope, ());
}
#[test]
fn an_unsized_connection_is_borrowable() {
let manager: &dyn core::fmt::Debug = &"a client";
let ctx = Connected::new(manager, ());
assert_eq!(format!("{:?}", ctx.connection()), "\"a client\"");
}
#[test]
fn a_bundle_is_const_constructible() {
const MANAGER: &str = "root";
const CTX: Connected<'static, str, ()> = Connected::new(MANAGER, ());
assert_eq!(CTX.connection(), "root");
}