diff options
Diffstat (limited to 'tests/ui/proc-macro/auxiliary/attr-cfg.rs')
-rw-r--r-- | tests/ui/proc-macro/auxiliary/attr-cfg.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/proc-macro/auxiliary/attr-cfg.rs b/tests/ui/proc-macro/auxiliary/attr-cfg.rs new file mode 100644 index 000000000..2f0054cc1 --- /dev/null +++ b/tests/ui/proc-macro/auxiliary/attr-cfg.rs @@ -0,0 +1,21 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn attr_cfg(args: TokenStream, input: TokenStream) -> TokenStream { + let input_str = input.to_string(); + + assert_eq!(input_str, "fn outer() -> u8 +{ + #[cfg(foo)] fn inner() -> u8 { 1 } #[cfg(bar)] fn inner() -> u8 { 2 } + inner() +}"); + + input +} |