2018-11-24 15:34:13 +02:00
|
|
|
// force-host
|
2018-03-15 23:20:56 -07:00
|
|
|
// no-prefer-dynamic
|
|
|
|
|
|
|
|
#![crate_type = "proc-macro"]
|
|
|
|
|
|
|
|
extern crate proc_macro;
|
|
|
|
|
|
|
|
use proc_macro::TokenStream;
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
|
assert!(attr.to_string().is_empty());
|
2020-06-14 14:30:42 +03:00
|
|
|
assert_eq!(item.to_string(), "let string = \"Hello, world!\" ;");
|
2018-03-15 23:20:56 -07:00
|
|
|
item
|
|
|
|
}
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn expect_print_stmt(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
|
assert!(attr.to_string().is_empty());
|
2021-05-01 15:54:47 -04:00
|
|
|
assert_eq!(item.to_string(), "println! (\"{}\", string) ;");
|
2018-03-15 23:20:56 -07:00
|
|
|
item
|
|
|
|
}
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
|
assert!(attr.to_string().is_empty());
|
|
|
|
assert_eq!(item.to_string(), "print_str(\"string\")");
|
|
|
|
item
|
|
|
|
}
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
|
assert!(attr.to_string().is_empty());
|
2021-05-01 15:54:47 -04:00
|
|
|
assert_eq!(item.to_string(), "println! (\"{}\", string)");
|
2018-03-15 23:20:56 -07:00
|
|
|
item
|
|
|
|
}
|
2018-04-02 17:21:37 -07:00
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn no_output(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
|
assert!(attr.to_string().is_empty());
|
|
|
|
assert!(!item.to_string().is_empty());
|
|
|
|
"".parse().unwrap()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn noop(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
|
assert!(attr.to_string().is_empty());
|
|
|
|
assert!(!item.to_string().is_empty());
|
|
|
|
item
|
|
|
|
}
|