MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_impl

Function test_impl

src/ore-proc/src/test.rs:29–44  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

27///
28/// Implementation for the `test` macro.
29pub 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
46fn expand_logging_init() -> TokenStream2 {
47 let crate_name = std::env::var("CARGO_PKG_NAME").unwrap();

Callers 1

testFunction · 0.70

Calls 4

expand_wrapperFunction · 0.85
as_sliceMethod · 0.80
collectMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected