-
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
report_mismatch doesn't handle parameter conversions #138
Comments
I don't think I understand. Can you provide a concrete example and what you see, and what you'd like to see? |
Actually the problem is not what I though it was. Now I'm not really sure what's going on. But it can be seen here:
If you run it as it is it outputs:
which is what I am expecting, all fine. But if you change the
which is what I was complaining about. Functor takes a |
Just to let you know I haven't forgotten about this issue. I can reduce it quite a lot, and actually short-circuit Trompeloeil out of it completely. If you just write Now, why it fails to compile if |
I am mocking a function which takes an
error_code
as a parameter (boost::system, but I guess it would be the same with std::error_code)TROMPELOEIL_MAKE_MOCK1(Functor, void(const error_code&));
And I'm setting a REQUIRE_CALL expectation as
Functor(error::invalid_validate_reply)
.error
being the enum which is implicitly convertible into error_code viastd::is_error_code_enum
magic.When the expectation fails trompeloeil outputs something like:
Expected _1 == 4-byte object={ 0x50 0x00 0x00 0x00 }
If instead I set the expectation as
Functor(make_error_code(error::invalid_validate_reply))
then I get a betterExpected _1 == <my_error_type>:5
Trompeloeil does know the function expects an error_code, but tries to print the parameter with the type of the function call instead of that of the function argument. No idea if it's even possible, but I would say that ideally it should never be printing
Expected _1 == 4-byte object={ 0x50 0x00 0x00 0x00 }
when it does know that5
is converted into an error_code in the function call.The text was updated successfully, but these errors were encountered: