Skip to main content

nu_test_support_macros/
lib.rs

1use syn::{ItemFn, parse::Nothing};
2
3mod test;
4mod test_cell_path;
5
6#[proc_macro_attribute]
7pub fn test(
8    attr: proc_macro::TokenStream,
9    item: proc_macro::TokenStream,
10) -> proc_macro::TokenStream {
11    syn::parse_macro_input!(attr as Nothing);
12    let item_fn = syn::parse_macro_input!(item as ItemFn);
13    test::test(item_fn).into()
14}
15
16// For docs to this, check out the re-export in `nu_test_support::test_cell_path!()`.
17#[proc_macro]
18pub fn test_cell_path(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
19    test_cell_path::test_cell_path(tokens.into())
20        .unwrap_or_else(|err| err.into_compile_error())
21        .into()
22}