summaryrefslogtreecommitdiff
path: root/macros/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-03-18 21:26:54 +0100
committerHampusM <hampus@hampusmat.com>2023-03-18 21:26:54 +0100
commit2d964b39da09ad82eccf09abdea73967bbff76f2 (patch)
treed5b43196d2402e62559e999adb65ef99f584eaf7 /macros/src/lib.rs
parent43e0bdb4cc598f199eacb63f755f30dc2108146b (diff)
feat: add support for generic traits
Diffstat (limited to 'macros/src/lib.rs')
-rw-r--r--macros/src/lib.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/macros/src/lib.rs b/macros/src/lib.rs
index 36c6ad7..8106a8c 100644
--- a/macros/src/lib.rs
+++ b/macros/src/lib.rs
@@ -34,11 +34,20 @@ pub fn mock(input_stream: TokenStream) -> TokenStream
})
.collect::<Vec<_>>();
- let mock = Mock::new(mock_ident.clone(), input.mocked_trait, &method_items);
+ let mock = Mock::new(
+ mock_ident.clone(),
+ input.mocked_trait,
+ &method_items,
+ input.item_impl.generics.clone(),
+ );
- let expectations = method_items
- .iter()
- .map(|item_method| Expectation::new(&mock_ident, item_method));
+ let expectations = method_items.iter().map(|item_method| {
+ Expectation::new(
+ &mock_ident,
+ item_method,
+ input.item_impl.generics.params.clone(),
+ )
+ });
quote! {
mod #mock_mod_ident {