Functions with lifetime argument can't be mocked
Functions like
#[mry::mry]
fn test<'a>(arg: &'a str) -> &'a str {
arg
}
causes error[E0261]: use of undeclared lifetime name 'a, and removing #[mry::mry] fixes the error.
Is this a bug or there's some additional syntax for this case?
Thanks for submitting. It’s just not implemented. I’ll fix this soon. Issues like this are helpful for making mry more mature.
Okay, I see. And thank you for the framework! It's really convenient and easy-to-use for small projects.
I've published mry 0.2.4, the problem should be resolved. Please reopen this issue if not resolved. There are still many missing features in mry that I am not aware of, so I'm glad if you open issues for any problems with mry.
Still no success... Apparently I've created a code bad enough to brake your macros :) https://github.com/rayslava/ytdlpwui/runs/6866944541?check_suite_focus=true#step:7:82
Oh, zero-copy things are a bit difficult in current mry features. It's because parameters must be 'static to be stored to call logs.
I think we need an attribute like #[mry::into(StaticStruct)] to convert a value with not 'static lifetime into something 'static one.
We need, otherwise, something like #[mry::no_call_log)] to make call logs unavailable.
Do you need to assert the function how called with assert_called? It uses call logs so needs 'static lifetime.
I've decided to support lifetime arguments in the future. I have thought about how to do it. It requires a few API changes.