File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ mod macro_args;
22mod test_args;
33
44use crate :: test_args:: { ContextArg , ContextArgMode , TestArg } ;
5- use macro_args:: TestContextArgs ;
5+ use macro_args:: MacroArgs ;
66use proc_macro:: TokenStream ;
77use quote:: { format_ident, quote} ;
88use syn:: ItemFn ;
@@ -29,7 +29,7 @@ use syn::ItemFn;
2929/// ```
3030#[ proc_macro_attribute]
3131pub fn test_context ( attr : TokenStream , item : TokenStream ) -> TokenStream {
32- let args = syn:: parse_macro_input!( attr as TestContextArgs ) ;
32+ let args = syn:: parse_macro_input!( attr as MacroArgs ) ;
3333 let input = syn:: parse_macro_input!( item as syn:: ItemFn ) ;
3434
3535 let ( input, context_args) = remove_context_args ( input, args. context_type . clone ( ) ) ;
@@ -86,7 +86,7 @@ fn remove_context_args(
8686
8787fn refactor_input_body (
8888 input : syn:: ItemFn ,
89- args : & TestContextArgs ,
89+ args : & MacroArgs ,
9090 context_arg : ContextArg ,
9191) -> syn:: ItemFn {
9292 let context_type = & args. context_type ;
Original file line number Diff line number Diff line change 11use syn:: { Token , Type , parse:: Parse } ;
22
3- pub ( crate ) struct TestContextArgs {
3+ /// Contains the parsed arguments passed to the macro `#[test_context(..)]`
4+ pub ( crate ) struct MacroArgs {
5+ /// The context type passed in the macro arguments.
6+ /// It must implement `TestContext` or `AsyncTestContext`
47 pub ( crate ) context_type : Type ,
8+
59 pub ( crate ) skip_teardown : bool ,
610}
711
8- impl Parse for TestContextArgs {
12+ impl Parse for MacroArgs {
913 fn parse ( input : syn:: parse:: ParseStream ) -> syn:: Result < Self > {
1014 let mut skip_teardown = false ;
1115 let mut context_type: Option < Type > = None ;
@@ -28,7 +32,7 @@ impl Parse for TestContextArgs {
2832 }
2933 }
3034
31- Ok ( TestContextArgs {
35+ Ok ( MacroArgs {
3236 context_type : context_type
3337 . ok_or ( input. error ( "expected at least one type identifier" ) ) ?,
3438 skip_teardown,
You can’t perform that action at this time.
0 commit comments