Skip to content

Commit d130c21

Browse files
committed
chore: type rename & docs
1 parent b37885d commit d130c21

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

test-context-macros/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod macro_args;
22
mod test_args;
33

44
use crate::test_args::{ContextArg, ContextArgMode, TestArg};
5-
use macro_args::TestContextArgs;
5+
use macro_args::MacroArgs;
66
use proc_macro::TokenStream;
77
use quote::{format_ident, quote};
88
use syn::ItemFn;
@@ -29,7 +29,7 @@ use syn::ItemFn;
2929
/// ```
3030
#[proc_macro_attribute]
3131
pub 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

8787
fn 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;

test-context-macros/src/macro_args.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
use 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,

0 commit comments

Comments
 (0)