jiffwan / googlemock

Automatically exported from code.google.com/p/googlemock
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

alternative to ReturnNew #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As an alternative to ReturnNew, another action could be implemented that, 
instead of returning a newly created object, would rather assign the address of 
newly created object to method parameter:

my_method (Object ** obj);

An action that I would propose to call "CreateAndPass" would then do the 
assignment:

*obj = new Object(...contructor params...);

Piotr

Original issue reported on code.google.com by pgo...@gmail.com on 20 Nov 2010 at 4:57

GoogleCodeExporter commented 9 years ago
I wanted to make this an enhancement, not a defect.

Original comment by pgo...@gmail.com on 20 Nov 2010 at 5:00

GoogleCodeExporter commented 9 years ago
I think this is too specialized to be added to gmock.  Please define a custom 
action instead.  See the cook book wiki for how to do that.

Also, a friendly reminder that we use the the issue tracker for bug reports and 
approved feature requests.  For new feature requests, please use the mailing 
list.  Thanks.

Original comment by w...@google.com on 22 Nov 2010 at 8:30

GoogleCodeExporter commented 9 years ago
My point was to add this as a new feature request and then contribute the
code that adds this functionality. If you think, however, that it is too
specialized, I will only keep this as my own custom action.

Piotr

Original comment by pgo...@gmail.com on 22 Nov 2010 at 8:39

GoogleCodeExporter commented 9 years ago
Thanks for offering to contribute!  The mailing list will be a great venue for 
discussions like this, as it reaches far more many people.

Yes, I think this is a bit too specialized.

Original comment by w...@google.com on 22 Nov 2010 at 9:01