diff options
author | HampusM <hampus@hampusmat.com> | 2023-08-01 13:07:42 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-08-01 13:07:42 +0200 |
commit | 4781795e26c242e7babafd25dc5010dfa988a7ea (patch) | |
tree | bd0d302c516aa5b417262deac3533e29a36f2e74 /macros/src | |
parent | 343661391c21f535e7b832f3fef05e09a61a0a29 (diff) |
test: fix create_single_get_dep_method_call unit tests
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/injectable/implementation.rs | 41 |
1 files changed, 25 insertions, 16 deletions
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::<ExprMethodCall>(output)?, - parse2::<ExprMethodCall>(quote! { + parse2::<Expr>(output)?, + parse2::<Expr>(quote! { #di_container_var_ident .get_bound::<Foo>(#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::<ExprMethodCall>(output)?, - parse2::<ExprMethodCall>(quote! { + parse2::<Expr>(output)?, + parse2::<Expr>(quote! { #di_container_var_ident .get_bound::<Foo>(#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::<ExprMethodCall>(output)?, - parse2::<ExprMethodCall>(quote! { + parse2::<Expr>(output)?, + parse2::<Expr>(quote! { #di_container_var_ident .get_bound::<Foo>(#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::<ExprMethodCall>(output)?, - parse2::<ExprMethodCall>(quote! { + parse2::<Expr>(output)?, + parse2::<Expr>(quote! { #di_container_var_ident .get_bound::<Foo>(#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" + })? })? ); |