use functor_derive_lib::Functor; #[test] fn conflicting_type_params_are_avoided() { #[allow(non_snake_case)] #[allow(unused)] #[derive(Functor)] struct A { D: (), B: B, F: F, } } #[test] fn fields_conflicting_with_items_are_supported() { #[allow(non_snake_case)] #[derive(Functor)] struct Test { funcmap: T, FuncMap: T, TypeParam: T, Output: T, func_map: T, f: T, } } #[test] fn nested_items_are_not_mistaken_for_generics() { mod test { pub struct T; } #[derive(Functor)] struct Test(T, test::T); } #[test] fn inherent_methods_are_not_mistaken_for_trait_methods() { #[derive(Functor)] struct Inner(T); #[allow(dead_code)] impl Inner { fn func_map(self) {} fn func_map_over(self) {} } #[derive(Functor)] struct Test(Inner); } #[test] fn trait_methods_are_not_confused_with_methods_of_other_traits() { #[derive(Functor)] struct Inner(T); trait LikeFuncMap: Sized { fn func_map(self) {} fn func_map_over(self) {} } impl LikeFuncMap for Inner {} impl LikeFuncMap for [T; N] {} #[derive(Functor)] struct Test(Inner, [T; N]); } #[test] fn raw_identifiers_are_supported() { #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] use functor_derive as r#break; #[derive(Functor)] struct r#continue(r#else); #[derive(r#break::Functor)] enum r#false { r#if { r#in: r#continue }, r#let, } }