#![feature(proc_macro)] extern crate trait_tests; #[allow(dead_code)] #[cfg(test)] mod example_tests { use trait_tests::*; trait Hello { fn get_greeting(&self) -> &str; } // type HelloTestsType1 = Dialect; // type HelloTestsType2 = String; #[trait_tests] trait HelloTests: Hello + Sized + Default { fn test() { assert!(Self::default().get_greeting().len() < 200); } } pub enum Dialect { American, } struct EnglisHelloImpl { dialect: Dialect, tag: X, } #[test_impl] impl Hello for EnglisHelloImpl { fn get_greeting(&self) -> &str { "Howdy" } } impl Default for EnglisHelloImpl { fn default() -> Self { EnglisHelloImpl { dialect: Dialect::American, tag: String::new(), } } } }