-
Notifications
You must be signed in to change notification settings - Fork 85
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
Issue #1: Back port Trompeloeil to C++11. #67
Conversation
Avoid static destruction fiasco for recursive_mutex Fix issue 55: restore warnings for Clang builds
Removed TROMPELOEIL_DEBUG_RE_FAILURE after confirming regex_check fixed.
Reorganized environment for g++-4.8 to see if it's recognized. Fix bug in `struct throw_handler_t` found by g++-7 AddressSanitizer.
- Require standard C++ mode without extensions. - g++-7: disabled sanitize-address-use-after-scope ASan check. - clang++4.0: enabled sanitize-address-use-after-scope ASan check. - Added -j 4 to make command line.
I have made some changes to improve Coveralls integration:
The drop in coverage in Thus there will be further updates as the review progresses. |
Apologies my lack of attention, but my ISP (bless their infinite incompetence) has left me without internet connection for a week now, and my fallback over the phone is running thin. I'll get back to you, but I hope you can live with my apparent absense for the moment. |
All is good. Plenty of work to get through on the current feedback. |
I have had a look at the history of Coveralls builds to find where browsing to the source of Working in build #328, branch develop, 5 July 2017. Working in build #330, branch master, 11 July 2017. Commit e57910f @rollbear rollbear committed on Jul 18 Broken in build #349, branch cmake, 20 July 2017. Broken in build #354, branch develop, 20 July 2017. Seems there is some update needed to |
I raised issue Make Catch_global_namespace_dummy a complete type in the Catch2 project summarizing the failure to compile Trompeloeil with |
That issue with coveralls not showing the source is so weird. I'm certain it worked after that |
There was an input field on the coveralls.io site, where I could enter a subdirectory to look for the file in. That worked out fine. |
include/trompeloeil.hpp
Outdated
@@ -529,10 +849,23 @@ namespace trompeloeil | |||
class duck_typed_matcher : public matcher | |||
{ | |||
public: | |||
#if TROMPELOEIL_GCC && TROMPELOEIL_GCC_VERSION < 40900 |
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.
I'm a bit confused by the operator std::string&&() const
added here. The comment implies that this is just to make the self test compile, but does this mean that duck typed matchers do not work with g++-4.8? If so, I wonder if it wouldn't be better to exclude those tests when building with g++-4.8.
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.
This is a long story to be told with whisky and tears in equal parts. The code here is the product of many other failed experiments. I am investigating the consequences of removing support for these g++-4.8
-specific user-defined conversions in duck_typed_matcher
and wildcard
on my production code base and will have a better idea of the direction to take in the next day or so.
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.
We live about as far apart as we can on this planet, but should we meet, I'll bring the whisky and you can cry your eyes out ;-)
No worries.
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.
I disabled the non-template user-defined conversions in wildcard
and
duck_typed_matcher
after finding
- No production code was affected by not having support for implicit
conversions fromwildcard
orduck_typed_matcher
to rvalue references. - Only five test cases failed without these user-defined conversions.
These are now guarded withTROMPELOEIL_TEST_RVALUE_REFERENCE_FAILURES
.
Interestingly onlywildcard
test cases failed: I could not find a test
case failure withduck_typed_matcher
.
Documentation in Backward.md
has been updated to explain the shortcomings
of g++-4.8
should someone stumble upon this issue.
It also appears that the impact on coverage as reported by Coveralls has
been minimal.
include/trompeloeil.hpp
Outdated
@@ -1279,14 +1615,30 @@ namespace trompeloeil | |||
noexcept | |||
{} | |||
|
|||
#if TROMPELOEIL_GCC && TROMPELOEIL_GCC_VERSION < 40900 |
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.
Same confusion here.
include/trompeloeil.hpp
Outdated
typename Sig, | ||
typename H, | ||
typename R = decltype(::trompeloeil::default_return<return_of_t<Sig>>())> | ||
struct throw_handler_t |
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.
Is there a reason for this to be a template? The template types are already known in the surrounding type and should be accessible.
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.
It turns out that Sig
can be dropped as a template parameter, using signature
instead.
R
can be made a type alias inside the struct
.
But H
remains as a template parameter of throw_handler_t
as it comes from the
template parameter H
of handle_throw
.
include/trompeloeil.hpp
Outdated
@@ -3498,6 +3991,9 @@ namespace trompeloeil | |||
unsigned long trompeloeil_expectation_line; \ | |||
const char *trompeloeil_expectation_string; \ | |||
\ | |||
using call_params_type_t = ::trompeloeil::call_params_type_t<sig>; \ | |||
using return_of_t = ::trompeloeil::return_of_t<sig>; \ |
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.
These types really should have a trompeloeil_
prefix to their names. It's not unimaginable that anyone may want to mock a function named return_of_t
, or call_params_type_t
.
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.
Done.
Added some comments/questions to ´trompeloeil.hpp`. I'll dive into the macros at the end of the file later. |
…n step. Actioned review comments: - Simplified class template throw_handler_t. - Renamed internal types in mock function implementation to avoid name clashes.
OK. I'm falling behind again, since my ISP finally "fixed" the problems (and I now have no internet connection at all instead of just a bad one.) I'll get back to you when things are working to at least some degree. |
Internet connection restored. I'll get back to you. There's just a bit of a backlog to wade through... |
Phiew. It took some time to read through. I'll let it simmer in the One question, though. The |
Thanks for the review and merge! I was just drafting this response Yes it is a good idea to let the code "rest" for a while in I am going to revert the As to their necessity and difference, the C++11 expectation macros expand This lead to all kinds of failures in the test cases in These utility macros were supposed to hide the actual stringized contents
This was another case of seeking but not finding a point-for-point C++11 I explained this difference in |
First round review.