Based on Copyright (C) 2019-2022 Daniel Mueller SPDX-License-Identifier: (Apache-2.0 OR MIT) Implementation for the `test` macro.
(attr: TokenStream, item: TokenStream)
| 27 | /// |
| 28 | /// Implementation for the `test` macro. |
| 29 | pub fn test_impl(attr: TokenStream, item: TokenStream) -> TokenStream { |
| 30 | let args: Vec<_> = |
| 31 | parse_macro_input!(attr with Punctuated::<Meta, Token![,]>::parse_terminated) |
| 32 | .into_iter() |
| 33 | .collect(); |
| 34 | let input = parse_macro_input!(item as ItemFn); |
| 35 | |
| 36 | let inner_test = match args.as_slice() { |
| 37 | [] => parse_quote! { ::core::prelude::v1::test }, |
| 38 | [Meta::Path(path)] => quote! { #path }, |
| 39 | [Meta::List(list)] => quote! { #list }, |
| 40 | _ => panic!("unsupported attributes supplied: {:?}", args), |
| 41 | }; |
| 42 | |
| 43 | expand_wrapper(&inner_test, &input) |
| 44 | } |
| 45 | |
| 46 | fn expand_logging_init() -> TokenStream2 { |
| 47 | let crate_name = std::env::var("CARGO_PKG_NAME").unwrap(); |
no test coverage detected