-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Validating excception contents #641
Comments
@mcraveiro I think this would be doable, but is currently not quite supported. After the recent Matchers rework, they are documented and the interface is likely to be stable for a while, but right now There have been couple of requests for combination of |
I was quite surprised that the matchers stuff is only concerned with error messages, completely ignoring exception type. Correct message in wrong exception type is never desirable. IMO it'd be better if each matcher class had a base exception type, which Catch would capture and pass on to the matcher to do their magic (simply compare |
This is now in Catch 2.0 branch and should find its way into master at some point. |
Hi,
Thanks very much for Catch, looks like a very interesting framework. I just started porting across my code from Boost.Test[1] and got stuck with what is most likely a trivial issue: checking the contents of an exception message. I checked the issues and found #563 - a similar problem, pointing to
CATCH_CHECK_THROWS_WITH
. However, my code is relying on user defined predicates to perform the matches[2]. Is it possible to do something similar to this with catch? i.e.:The advantage of this approach is that I can also check additional information supplied by Boost.Exception and also make fuzzier checks on the message string (rather than just equality).
Many thanks for your time.
Marco
[1] http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/index.html
[2]
http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref/assertion_boost_level_exception.html
The text was updated successfully, but these errors were encountered: