2018-11-24 07:34:13 -06:00
|
|
|
// force-host
|
2018-05-01 18:57:42 -05:00
|
|
|
// no-prefer-dynamic
|
|
|
|
|
|
|
|
#![crate_type = "proc-macro"]
|
|
|
|
|
|
|
|
extern crate proc_macro;
|
|
|
|
|
|
|
|
use proc_macro::TokenStream;
|
|
|
|
|
|
|
|
#[proc_macro_derive(UnionTest)]
|
|
|
|
pub fn derive(input: TokenStream) -> TokenStream {
|
|
|
|
let input = input.to_string();
|
|
|
|
assert!(input.contains("#[repr(C)]"));
|
|
|
|
assert!(input.contains("union Test {"));
|
2020-06-14 06:30:42 -05:00
|
|
|
assert!(input.contains("a : u8,"));
|
2018-05-01 18:57:42 -05:00
|
|
|
assert!(input.contains("}"));
|
|
|
|
"".parse().unwrap()
|
|
|
|
}
|