summaryrefslogtreecommitdiffstats
path: root/third_party/rust/darling/tests/generics.rs
blob: a83d03e284b7c7334947e9caa47c0895f302034b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#[macro_use]
extern crate darling;
#[macro_use]
extern crate syn;
#[macro_use]
extern crate quote;

use darling::FromDeriveInput;

#[derive(Debug, Clone, FromMeta)]
struct Wrapper<T>(pub T);

#[derive(Debug, FromDeriveInput)]
#[darling(attributes(hello))]
struct Foo<T> {
    lorem: Wrapper<T>,
}

#[test]
fn expansion() {
    let di = parse_quote! {
        #[hello(lorem = "Hello")]
        pub struct Foo;
    };

    Foo::<String>::from_derive_input(&di).unwrap();
}