#[cfg(test)] mod test { use rustpub::simple::core::*; macro_rules! parse_test { ($name:ident, $($cases:expr),+) => { #[test] fn $name() { let cases = vec![ $($cases),+ ]; println!(); for case in cases { println!("{}", case); let parsed: Box = serde_json::from_str(case).unwrap(); println!("{:?}", parsed); let serialized: String = serde_json::to_string(&parsed).unwrap(); println!("{}", serialized); } } }; } parse_test!(attachment, include_str!("../tests/attachment_1.json")); parse_test!( attributed_to, include_str!("../tests/attributed_to_1.json"), include_str!("../tests/attributed_to_2.json") ); parse_test!(audience, include_str!("../tests/audience_1.json")); parse_test!( content, include_str!("../tests/content_1.json"), include_str!("../tests/content_2.json"), include_str!("../tests/content_3.json") ); parse_test!(context, include_str!("../tests/context_1.json")); parse_test!(generator, include_str!("../tests/generator_1.json")); parse_test!( in_reply_to, include_str!("../tests/in_reply_to_1.json"), include_str!("../tests/in_reply_to_2.json") ); parse_test!(media_type, include_str!("../tests/media_type_1.json")); parse_test!( name, include_str!("../tests/name_1.json"), include_str!("../tests/name_2.json") ); parse_test!( summary, include_str!("../tests/summary_1.json"), include_str!("../tests/summary_2.json") ); parse_test!(tag, include_str!("../tests/tag_1.json")); }