-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trailing_return_mock #341
trailing_return_mock #341
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #341 +/- ##
=======================================
Coverage 99.40% 99.40%
=======================================
Files 15 15
Lines 1344 1344
Branches 22 21 -1
=======================================
Hits 1336 1336
Misses 8 8 ☔ View full report in Codecov by Sentry. |
Updated reference manual and FAQ. I'm not sure about how to best update the cookbook. |
Updated all documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of mock.cpp
remains to be done.
Working my way through the new documentation, Q: Is a templated trailing return type e.g. struct M
{
MAKE_MOCK(make, auto (int) -> std::pair<int, int>);
}; Q: Why is the number of arguments different between the different implementations of If |
Hmm, no. Good catch. What happens is that it assumes
The honest answer is that I didn't originally write it so, and changed it when I found out it didn't work. I got an off-by-one error without it. It's not so strange, though. Without |
9af4275
to
fb4f732
Compare
I finally found the time and energy to do this. New macros
MAKE_MOCK
,MAKE_CONST_MOCK
andMAKE_STDTMETHOD_MOCK
. They all require trailing return type syntax for the function signature, and they deduce the arity of the function from the signature.@AndrewPaxie, if you have the time and ability, I would really appreciate an extra pair of eyes on this change. It's a big one, and the surprisingly many ways in which different preprocessors handle macros is a huge source of trouble.
This only supports nullary functions if
__VA_OPT__
is available, i.e. in C++20 and later (and for MSVC when using /Zc:preprocessor, on a sufficiently recent compiler).Inofficially nullary functions may work by defining the macro
TROMPELOEIL_HAS_GCC_PP
, but I have not tested it.I plan to write documentation and ChangeLog this weekend.
This would be a nice big 10-year anniversary feature.