aboutsummaryrefslogtreecommitdiff
path: root/macros/src/injectable/implementation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/injectable/implementation.rs')
-rw-r--r--macros/src/injectable/implementation.rs41
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"
+ })?
})?
);