You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While there exist other libraries already capable of doing this, it might be nice to also provide that functionality here to not force the user to find yet another mocking framework on top of faux.
The text was updated successfully, but these errors were encountered:
I took a quick look at this and I would love to implement something that looks like:
#[faux::create]traitMyTrait{/* some methods */}#[test]fntest(){let mock = MyTrait::faux();}
This however seems to only be possible if MyTrait is object safe which has a lot of limitations that I am not sure are desired.
Another issue I am having is that I don't know how should generics and associated items should work.
Should all generics in a trait also go into the created struct?
Should associated types in a trait be generics of the struct or should the user have to specify them as a macro argument?
How should associated constants (which are not allowed if we require object safety) be declared?
Should associated functions be mockable? They are not in structs since that would require some sort of "global" mock store, but for a trait maybe we could?
Since I don't really have a use case for this, I always mock structs, I don't really know what the desired behavior for some of these may be. I also don't know what limitations are acceptable and which ones would make the feature useless.
In short, this is theoretically feasible but I would love help understanding the requirements before I implement something that isn't valuable for those that need it.
While there exist other libraries already capable of doing this, it might be nice to also provide that functionality here to not force the user to find yet another mocking framework on top of
faux
.The text was updated successfully, but these errors were encountered: