//! Contains simple successful `#[derive(RequestContext)]` tests. //! //! Negative tests are in the derive implementation. use hyperdrive::RequestContext; fn assert_impls() {} #[test] fn unit() { #[derive(RequestContext)] struct Unit; assert_impls::(); } #[test] fn empty() { #[derive(RequestContext)] struct Empty; assert_impls::(); } #[test] fn simple() { #[derive(RequestContext)] struct Simple { _field: u8, } assert_impls::(); } #[test] fn as_ref() { #[derive(RequestContext)] struct Refs { #[as_ref] _field: u8, } assert_impls::(); // Additional impl added: let _ = >::as_ref; } #[test] fn as_ref_tuple() { #[derive(RequestContext)] struct Refs(#[as_ref] u16); assert_impls::(); // Additional impl added: let _ = >::as_ref; } #[test] fn on_enum() { #[derive(RequestContext)] enum Ctx {} assert_impls::(); #[derive(RequestContext)] #[allow(unused)] enum Ctx2 { Variant, Variant2 { inner: u32 }, } assert_impls::(); }