[bind10-dev] proposal: catching exceptions in run_unittests.cc:main()

Jelte Jansen jelte at isc.org
Tue Jan 25 09:39:08 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/25/2011 10:23 AM, Michal 'vorner' Vaner wrote:
>>
>> What's the purpose of using EXPECT_NO_THROW, btw?  So that you can
>> still run the rest of the tests (in the same run_unittests program)?
>> If so, I see the point, and in that case I wonder whether we might
>> write an additional wrapper:
> 
> Yes, I noticed that problem as well. But I found it more useful to have the
> output of other EXPECT_ statements in the same test which fail than the actual
> exception. They can clue a lot on what's going on.
> 
> And yes, the other point about it is I want to run the other tests as well.
> 
> A wrapper telling more would be nice. We could catch std::exception as well and
> print it's e.what(), which might tell something as well, even when we don't have
> the line numbers.
> 

for our own exceptions we should still have the location of the original error,
but I personally find that I often want the full stacktrace anyway.

In the case of EXPECT_NO_THROW, I tend to remove the guard, re-run the test, fix
the problem, then add it again. So I agree that in most cases, EXPECT_NO_THROW
seems a bit useless (at least in the problems I found where it did throw).
However, any other wrapper that catches it would have the same problem, if you
need the full stacktrace.

Jelte
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0+mjwACgkQ4nZCKsdOncXUmQCgjRvroQkVP+xcA36/0jMd1MUw
ZJQAoJKLsJZW6qU1ssuOrsuLJNW9eeD3
=WxGx
-----END PGP SIGNATURE-----



More information about the bind10-dev mailing list