vegetablemao / googlemock

Automatically exported from code.google.com/p/googlemock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alternative to ReturnNew

GoogleCodeExporter opened this issue · comments

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

I wanted to make this an enhancement, not a defect.

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

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

  • Changed state: WontFix
  • Added labels: OpSys-All, Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect
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

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