mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-19 12:35:07 +00:00
moved all crates into seperate folder + related path fixes
This commit is contained in:
parent
12ef03bb86
commit
eee85fa45d
1063 changed files with 92 additions and 93 deletions
28
crates/compiler/test_mono_macros/src/lib.rs
Normal file
28
crates/compiler/test_mono_macros/src/lib.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use quote::quote;
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn mono_test(_args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let task_fn = syn::parse_macro_input!(item as syn::ItemFn);
|
||||
|
||||
let args = task_fn.sig.inputs.clone();
|
||||
|
||||
let name = task_fn.sig.ident.clone();
|
||||
let name_str = name.to_string();
|
||||
let body = task_fn.block.clone();
|
||||
|
||||
let visibility = &task_fn.vis;
|
||||
let attributes = task_fn.attrs;
|
||||
|
||||
let result = quote! {
|
||||
#[test]
|
||||
#(#attributes)*
|
||||
#visibility fn #name(#args) {
|
||||
compiles_to_ir(#name_str, #body);
|
||||
|
||||
}
|
||||
};
|
||||
result.into()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue