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