1 extern crate syn; 2 3 mod features; 4 5 macro_rules! should_parse { 6 ($name:ident, { $($in:tt)* }) => { 7 #[test] 8 fn $name() { 9 // Make sure we can parse the file! 10 syn::parse_file(stringify!($($in)*)).unwrap(); 11 } 12 } 13 } 14 15 should_parse!(generic_associated_type, { 16 impl Foo { 17 type Item = &'a i32; 18 fn foo<'a>(&'a self) -> Self::Item<'a> {} 19 } 20 }); 21 22 #[rustfmt::skip] 23 should_parse!(const_generics_use, { 24 type X = Foo<5>; 25 type Y = Foo<"foo">; 26 type Z = Foo<X>; 27 type W = Foo<{ X + 10 }>; 28 }); 29 30 should_parse!(trailing_plus_type, { 31 type A = Box<Foo>; 32 type A = Box<Foo + 'a>; 33 type A = Box<'a + Foo>; 34 }); 35 36 should_parse!(generic_associated_type_where, { 37 trait Foo { 38 type Item; 39 fn foo<T>(&self, t: T) -> Self::Item<T>; 40 } 41 }); 42 43 should_parse!(match_with_block_expr, { 44 fn main() { 45 match false { 46 _ => {}.a(), 47 } 48 } 49 }); 50