1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 20:12:58 +01:00

Merge pull request #127 from rubdos/test-fixture-integration

Forward actix_rt::test arguments to test function.
This commit is contained in:
Yuki Okushi 2020-04-09 17:45:17 +09:00 committed by GitHub
commit e9e2185296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,7 @@ pub fn test(_: TokenStream, item: TokenStream) -> TokenStream {
let input = syn::parse_macro_input!(item as syn::ItemFn);
let ret = &input.sig.output;
let inputs = &input.sig.inputs;
let name = &input.sig.ident;
let body = &input.block;
let attrs = &input.attrs;
@ -81,7 +82,7 @@ pub fn test(_: TokenStream, item: TokenStream) -> TokenStream {
let result = if has_test_attr {
quote! {
#(#attrs)*
fn #name() #ret {
fn #name(#inputs) #ret {
actix_rt::System::new("test")
.block_on(async { #body })
}
@ -90,7 +91,7 @@ pub fn test(_: TokenStream, item: TokenStream) -> TokenStream {
quote! {
#[test]
#(#attrs)*
fn #name() #ret {
fn #name(#inputs) #ret {
actix_rt::System::new("test")
.block_on(async { #body })
}