Open GoogleCodeExporter opened 9 years ago
I like the idea in general. I would like to see it a bit more generic, though.
Some frameworks such as MFC
define their own exception classes which do not derive from std::exception and
do not implement what(). Since
Google Test is a general purpose framework, I'd like those classes covered as
well. This is possible now, with
the universal printer ported from Google Mock. Instead of
if (e.what() == error_string) {
The code should look like this:
if (::testing::internal::PrintToString(e) == error_string) {
For further flexibility, employ regex matching rather than simple string
comparison.
Regarding the implementation, any new code requires tests, including this one.
Most of the test should mirror
ones for existing constructs such as EXPECT_THROW, but some will need to be
written specifically for this one
(e.g., verifying that an exception of the right type with the right string
representation is intercepted and
logged as a failure while exceptions whose types or string representations
don't match are not intercepted).
And finally, before we can accept a code contribution we need to ask you to
sign a CLA as described in
http://code.google.com/p/googletest/wiki/GoogleTestDevGuide#Contributing_Code).
If all that doesn't daunt you, we are happy to accept your contribution.
Original comment by vladlosev
on 18 May 2010 at 7:15
I'd like to see this done after we port matchers to gtest. Then we can write
EXPECT_THROW_THAT(statement, matcher)
or something like that, which is much more flexible.
Original comment by shiq...@gmail.com
on 18 May 2010 at 7:27
Lowering the priority as I don't think this is needed often.
Original comment by w...@google.com
on 27 Sep 2010 at 7:23
Original issue reported on code.google.com by
trox...@gmail.com
on 17 May 2010 at 10:07