From 4781795e26c242e7babafd25dc5010dfa988a7ea Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 1 Aug 2023 13:07:42 +0200 Subject: test: fix create_single_get_dep_method_call unit tests --- macros/src/injectable/implementation.rs | 41 ++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'macros/src/injectable') diff --git a/macros/src/injectable/implementation.rs b/macros/src/injectable/implementation.rs index 30132bf..39207b3 100644 --- a/macros/src/injectable/implementation.rs +++ b/macros/src/injectable/implementation.rs @@ -576,6 +576,7 @@ mod tests AttrStyle, Attribute, Block, + Expr, ImplItemMethod, LitStr, Pat, @@ -874,8 +875,8 @@ mod tests )?; assert_eq!( - parse2::(output)?, - parse2::(quote! { + parse2::(output)?, + parse2::(quote! { #di_container_var_ident .get_bound::(#dep_history_var_ident.clone(), None) .map_err(|err| InjectableError::ResolveFailed { @@ -883,8 +884,10 @@ mod tests affected: self_type_name })? .transient() - .unwrap() - + .map_err(|err| InjectableError::PrepareDependencyFailed { + reason: err, + dependency_name: "Foo" + })? })? ); @@ -920,8 +923,8 @@ mod tests )?; assert_eq!( - parse2::(output)?, - parse2::(quote! { + parse2::(output)?, + parse2::(quote! { #di_container_var_ident .get_bound::(#dep_history_var_ident.clone(), Some("special")) .map_err(|err| InjectableError::ResolveFailed { @@ -929,8 +932,10 @@ mod tests affected: self_type_name })? .transient() - .unwrap() - + .map_err(|err| InjectableError::PrepareDependencyFailed { + reason: err, + dependency_name: "Foo" + })? })? ); @@ -964,8 +969,8 @@ mod tests )?; assert_eq!( - parse2::(output)?, - parse2::(quote! { + parse2::(output)?, + parse2::(quote! { #di_container_var_ident .get_bound::(#dep_history_var_ident.clone(), None) .await @@ -974,8 +979,10 @@ mod tests affected: self_type_name })? .transient() - .unwrap() - + .map_err(|err| InjectableError::PrepareDependencyFailed { + reason: err, + dependency_name: "Foo" + })? })? ); @@ -1012,8 +1019,8 @@ mod tests )?; assert_eq!( - parse2::(output)?, - parse2::(quote! { + parse2::(output)?, + parse2::(quote! { #di_container_var_ident .get_bound::(#dep_history_var_ident.clone(), Some("foobar")) .await @@ -1022,8 +1029,10 @@ mod tests affected: self_type_name })? .transient() - .unwrap() - + .map_err(|err| InjectableError::PrepareDependencyFailed { + reason: err, + dependency_name: "Foo" + })? })? ); -- cgit v1.2.3-18-g5258