Hello guys, Here is a new patch for exception tests. New macros are: EXPECT_THROW(expression, expectedexcetion) ...
17 years, 1 month ago
(2008-07-26 02:51:56 UTC)
#1
Hello guys,
Here is a new patch for exception tests.
New macros are:
EXPECT_THROW(expression, expectedexcetion)
ASSERT_THROW(expression, expectedexcetion)
EXPECT_NO_THROW(expression)
ASSERT_NO_THROW(expression)
Please comment it!
Regards,
Balazs
http://codereview.appspot.com/2663/diff/1/4
File include/gtest/internal/gtest-internal.h (right):
http://codereview.appspot.com/2663/diff/1/4#newcode521
Line 521: if (::testing::internal::GetCatchExceptionsFlag()) { \
I'm not sure is this flag counts here or not.. the purpose of this macro is
testing an exception so controlling it with this flag maybe unnecessary.
Patch improved after Zhanyong's comments.
I believe const& exceptions are the best way to handle exceptions in tests, but
I've created a new macro for ... tests. Hope this will satisfy everyone :)
Partially done, but I dont understand your test request.. http://codereview.appspot.com/2663/diff/41/42 File test/gtest_unittest.cc (right): http://codereview.appspot.com/2663/diff/41/42#newcode2459 Line ...
Partially done, but I dont understand your test request..
http://codereview.appspot.com/2663/diff/41/42
File test/gtest_unittest.cc (right):
http://codereview.appspot.com/2663/diff/41/42#newcode2459
Line 2459:
I'm not sure how to make this test!? It will catch both.
Eg. ASSERT_THROW(Foo(), const char*) will catch these:
throw (const char*) "string";
throw (char* const) "string";
throw (const char* const) "string";
Issue 2663: Exception tests
Created 17 years, 1 month ago by Balazs.Dan
Modified 10 years, 9 months ago
Reviewers: Zhanyong
Base URL: http://googletest.googlecode.com/svn/trunk/
Comments: 36