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
The syntax .Return<type>(obj) to force the object to be copied and .Return<type&>(obj) to force the object to be captured by reference have been removed by #330 be caused it caused issues with the new implementation of .Return(obj), and because it was not a real documented feature (but more a by-product of the implementation), I supposed no one was relying on it.
It turns out that some people use this feature (see #200 (comment) and #336 (comment)), not only to change the behavior of .Return(obj), but also to have a consistent behavior, i.e. having .Return(obj) do the same thing regardless of if the mocked function return a reference or an object.
What should be done:
Reintroduce back the support for .Return<type>(obj) and .Return<type&>(obj) to not break to much code with the new update, maybe mark them as deprecated.
Make .ReturnCapture(obj) available on any function (those that return a reference and those that does not) so it can be used as a default when the user ALWAYS want to capture the value of the object, regardless of the return type of the mocked function.
Extend the two functions mentioned above so they support the extra features of Return (e.g. .Return(obj1, obj2, ...), .Return(val_Times(5)), maybe more).
The text was updated successfully, but these errors were encountered:
The syntax
.Return<type>(obj)
to force the object to be copied and.Return<type&>(obj)
to force the object to be captured by reference have been removed by #330 be caused it caused issues with the new implementation of.Return(obj)
, and because it was not a real documented feature (but more a by-product of the implementation), I supposed no one was relying on it.It turns out that some people use this feature (see #200 (comment) and #336 (comment)), not only to change the behavior of
.Return(obj)
, but also to have a consistent behavior, i.e. having.Return(obj)
do the same thing regardless of if the mocked function return a reference or an object.What should be done:
.Return<type>(obj)
and.Return<type&>(obj)
to not break to much code with the new update, maybe mark them as deprecated..ReturnCapture(obj)
available on any function (those that return a reference and those that does not) so it can be used as a default when the user ALWAYS want to capture the value of the object, regardless of the return type of the mocked function..ReturnCapture(obj)
but that forces the capture of the object by reference, this feature already as its own issue ((Always)Return doesn't seem to allow capturing locals by reference? #200).Return
(e.g..Return(obj1, obj2, ...)
,.Return(val_Times(5))
, maybe more).The text was updated successfully, but these errors were encountered: