Open GoogleCodeExporter opened 9 years ago
Correction: #1 means 80 more macros when we consider 'const volatile', and 160
when we add exception spec into the picture. Definitely not the way to go.
Original comment by w...@google.com
on 8 Sep 2010 at 8:56
I've took a look into updating my partial implementation of #1 into something
more like #2.
One issue is generating the identifier for the FunctionMocker member, which
needs to include qualifiers.
Currently I supply volatile as another parameter to GMOCK_METHOD0_. Adding
exception specs we end up with 6 parameters. This seems a bit much:
GMOCK_METHOD0(const, volatile, exception-spec, call-type, name, signature);
The first 3 parameters are only separate arguments so that the FunctionMocker
member identifier can be generated. With an alternate way to generate the
identifier I think we could merge those 3 into a single param:
GMOCK_METHOD0(qualifiers, call-type, name, signature);
Some options for generating the identifier:
- Rely on the __LINE__ or __COUNTER__ (non standard, in gcc-4.3 and msvc)
macros.
- Might be possible to use some other macro hackery.
Any thoughts?
- Edgar
Original comment by edgar.el...@caris.com
on 15 Sep 2010 at 8:11
My suggestion is (for your new macros) to forget about using the CV qualifiers
as part of the identifier name. That is only useful in very rare cases.
I agree on merging the CV qualifiers and the exception spec into one parameter.
That will give us:
GMOCK_METHOD1(STDMETHODCALLTYPE, MethodName, int(bool),
const volatile throw(Foo));
(I'm putting the call type first to be consistent with
MOCK_METHOD0_WITH_CALLTYPE.)
Original comment by w...@google.com
on 15 Sep 2010 at 8:28
Original comment by w...@google.com
on 27 Sep 2010 at 9:39
Original comment by w...@google.com
on 24 Feb 2011 at 8:08
Hi, is there any chance this will be added soon?
Original comment by lukasz.c...@gmail.com
on 27 May 2014 at 12:03
Sorry I never did get around to incorporating the suggestions. I'll take a stab
this week.
Original comment by edgar.el...@caris.com
on 27 May 2014 at 11:19
Patch submitted: https://codereview.appspot.com/103030043
Notes:
- Mocking overloaded methods on the same line will not longer works (mentioned
above).
- Add macros: GMOCK_QUALIFIED_METHOD*(..., method, qualifiers, signature)
- Having the qualifiers as the last parameter was not possible, due to the use
of __VA_ARGS__ for the signature. So I put them after the method name.
Original comment by oat...@gmail.com
on 3 Jun 2014 at 4:54
Original issue reported on code.google.com by
w...@google.com
on 8 Sep 2010 at 8:55