-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
Throwing exception in a mocked method #265
Comments
well this is printed by the doctest framework - it has intercepted a I don't know enough about Trompeloeil but I doubt that this issue is related to doctest. |
Thank you for the reply. Anyway, that's strange, since my method Uhm... Maybe it's a Trompeloeil issue? |
I don't know... Did you try defining |
I tried and now it's failing with another error:
I debugged the code and it crash as it calls
|
I don't think this is related to doctest - you could try to separate this from the doctest stuff and try to reproduce it in a simple main() function. I also don't have experience with mocking frameworks - you could ask this in the issues section of Trompeloeil - and make sure to include the entire code and not separate snippets, so it's easier to understand. Sorry for not being able to help. |
@onqtam you have been very supportive and kind. I've followed your hint and I tried to rewrite the test bypassing Trompeloeil (so implementing manually a mocked class) and it works as expected, so I guess that there is something that I'm missing in Trompeloeil. Thank your patience and I'm sorry wasted your time. |
Description
I am mocking a method in order to raise an exception (using Trompeloeil) and I want to check if its caller protect itself catching the exception correctly.
Steps to reproduce
This is a very simplified version of my code:
The test should check whether the method
mayThrow
throws an exception, its caller method (throwerCaller
) returnsfalse
.Running this code it will abort due to a crash:
Not sure that this is an issue of Doctest or Trompeloeil.
The text was updated successfully, but these errors were encountered: